in reply to collect output of system()

From perldoc -f system:
The return value is the exit status of the program as returned by the "wait" call. To get the actual exit value, shif +t right by eight (see below). See also "exec". This is not wha +t you want to use to capture the output from a command, for t +hat you should use merely backticks or "qx//", as described in "`STRING`" in perlop.

So, if you are interested in the output of the external command, you need to use backticks or qx.

Note that system does not "skip" the shell at all.

Also, for portability sake, it's best to look for a builtin or module that will do what you want, rather than forking to the shell. Whether or not one is available, depends on what you are doing.

Cheers,
Darren :)

Replies are listed 'Best First'.
Re^2: collect output of system()
by pc88mxer (Vicar) on Feb 27, 2008 at 16:32 UTC
    Calling system with multiple arguments will skip the shell, at least under Unix systems. When called with a single argument the shell will also be skipped if there are no shell meta-characters in the argument.