run unix commands in perl
May 18th, 2006 by Lawrence David
to run a unix command in a perl script, use backticks. for example to call curl in perl:
`curl -o file.out “http://stinkpot.afraid.org:8080″`
May 18th, 2006 by Lawrence David
to run a unix command in a perl script, use backticks. for example to call curl in perl:
`curl -o file.out “http://stinkpot.afraid.org:8080″`
Thanks for info. I’ve been looking for a way to do this.
Another way to do this is by using thte function system. Something like:
system(‘curl -o file.out “http://stinkpot.afraid.org:8080″’);
The backticks are actually supposed to set a string to the output of a command. For example something like:
@dirs = split(/\n/, `ls | more`);
and therefore are blocking.
If you include an & in the command given to system it will be non-blocking.
thanks for the info ali!
6f1cea4f6c5b…
6f1cea4f6c5b7f509c07…
may i know how to use unix command: “history” in perl script? where I need to list out the history of the unix command in a perl script.