Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Storing system grep's output to an array in perl

by vinoth.ree (Monsignor)
on Mar 07, 2013 at 11:32 UTC ( #1022206=note: print w/replies, xml ) Need Help??

in reply to Storing system grep's output to an array in perl

system() executes the command specified but it doesn't capture the output of the command.

system() will return the exit status of the command as returned by the 'wait' call.


Use backtick(``) to capture the specified command's output.

my @array = `grep -i "top-" filename | awk '(print $3)'`;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022206]
[shmem]: Lady_Aleena: see perlsub for AUTOLOAD
[Discipulus]: well AUTOLOAD does auto load (if nothing is found you know what to do)
Lady_Aleena goes to read, may take a bit.
[Lady_Aleena]: Um, okay...
[karlgoethebier]: Lady_Aleena see also the source code of Shell

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-06-26 08:56 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (574 votes). Check out past polls.