[ Date Index ][
Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]
Mark, Easy peesy! There are two ways I know of. The easiest is just like in the shell, use back-ticks, that's the quote char on the top left of the keyboard, for example: @lines = `php phpscript.php`. If you don't want to use the back-tick, use qx instead: @lines = qx(php phpscript.php). You should get each element of the array @lines containing a line of output. You can also assign to a scalar, and the lines will be concatenated. The second way is to use a pipe: open (PIPEHANDLE, "php phpscript.php |") || die "$!"; then read each line from PIPEHANDLE as you would a file. That may be more complicated than you need, but you have more control. Let me know if you need more. Clive -----Original Message----- From: Mark Cubitt To: list@xxxxxxxxxxxx Sent: 6/12/03 10:16 AM Subject: [LUG] Perl "system or exec" commands into a var is there a way I can execute a command with perl and put the output into a variable, I'm guessing this is quite easy but I can't find how to achive this. if it help the command i want to run is "php phpscript.php". thanks in advance regards Mark Cubitt ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: <http://www.star.net.uk> http://www.star.net.uk ________________________________________________________________________ ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ -- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe.