On Jan 22, Kevin Kirwan said:
>$command=q(/usr/bin/last vtran|head -1|awk '{print $4,$5}');
>$Last=system "$command";
>print $Last;
>
>This returns the fields that I want, except I also get the return code (0),
No. This prints the fields you want when you call system(), and returns
the error code (0) to $Last. system() is documented thus -- it executes
what you tell it to execute, and returns the return value.
If you want to capture the output, use backticks instead:
$output = `$command`;
or
$output = qx!$command!;
The qx// operator, as well as backticks (``), are documented in perlop.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]