sKiBa has asked for the wisdom of the Perl Monks concerning the following question:
Have just started learning perl this week and it seems to be going well but I have hit a brick wall. I'm trying to do something I think should be relatively simple, I want to be able to manipulate the output of the free command on linux. All I want to do is read each line into an array so I can play with the values a little.
Is an array the most sensible approach for this? Or should I use a hash? It seems that when I do this the whole lines get put into the first part of the array, lets say $array[0] whereas I want each word to go into each part of the array. I tried using split but can't seem to find the appropriate regex to split on the values.
Can anyone help?
Cheers!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting output of a system command into an array
by FunkyMonk (Bishop) on Sep 29, 2007 at 17:42 UTC | |
by jwkrahn (Abbot) on Sep 29, 2007 at 20:50 UTC | |
by sKiBa (Initiate) on Sep 29, 2007 at 17:58 UTC | |
by FunkyMonk (Bishop) on Sep 29, 2007 at 18:23 UTC | |
|
Re: Splitting output of a system command into an array
by shmem (Chancellor) on Sep 30, 2007 at 09:39 UTC | |
|
Re: Splitting output of a system command into an array
by TGI (Parson) on Sep 30, 2007 at 19:00 UTC | |
|
Re: Splitting output of a system command into an array
by lyklev (Pilgrim) on Sep 30, 2007 at 21:51 UTC |