On Fri, 5 Mar 2004, Connell Gauld wrote:
> Hey,
> I'm trying to right a perl script on Linux which will run a certain
> executable.
> Is there a Perl command which will do this eg:
> command "/bin/something parameters";
>
> Thanks for any help.
> Connell Gauld
There are several.
$s = system ("/bin/something parameters"); will call whatever shell you're
using, and return the exit code of 'something'.
$s = system ("/bin/something", "parameter1", "paremeter2"); will call
'something' directly, bypassing the shell, and feeding it the paremeters.
Again returns the exit code.
$s = `/bin/something parameters`; returns the output of the command.
@s = `/bin/something parameters`; returns the output of the command as an
array, with each element containing one line of output.
Then there are pipes, which are mildly more complicated. If you just want
to run an external program, chances are you don't need them.
Paul Lalli
|