in reply to Executing unix command in perl and getting the output

I must say I am curious why one would want to invoke an additional instance of the shell in order to perform this task when it could easily be carried out within Perl - For example the above shell call could be reduced to the following:

my $number = scalar @{[ glob $name ]};

I have written about this topic before from a security perspective in the node - Think beyond Taint and warnings

 

perl -le 'print+unpack("N",pack("B32","00000000000000000000001000010110"))'

Replies are listed 'Best First'.
Re: Re: Executing unix command in perl and getting the output
by kirk123 (Beadle) on Jan 14, 2003 at 01:34 UTC
    Actually, I was trying to execute the unix command lpstat -o and passing in the variable $name. Which is the result of another command and whose value I don't know. Thanks for input --kirk123