cutter has asked for the wisdom of the Perl Monks concerning the following question:
Using this code (example 1) I can load the entire output into the array, but when I try to grep (example 2) to just load the data, not the header I have problems. Example 1Job Name Last Start Last End ST Run + Pri/Xit ____________________________ ________________ ________________ __ ____ +___ ___ OPR_D_FTP_DAILY_NY_NT 03/13/2003 06:30 03/13/2003 06:30 SU 7252 +38/1
Example 2my $job_name="OPR_D_FTP_DAILY_CLT_NT"; my @job_autorep= split /\s+/,`autorep -j $job_name`;
my @job_autorep= split /\s+/, grep {/$job_name/},`autorep -j $job_name`;
Example 2 returns 1 as the value. I have tried changing the split pattern without any luck, also just using grep without the split returns the data line that I want, but loads it as one value in the array. Any suggestions? Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split into an array
by Thelonius (Priest) on Mar 13, 2003 at 22:41 UTC | |
|
Re: Split into an array
by pfaut (Priest) on Mar 13, 2003 at 21:58 UTC | |
|
Re: Split into an array
by dga (Hermit) on Mar 13, 2003 at 22:49 UTC | |
|
Re: Split into an array
by cutter (Acolyte) on Mar 14, 2003 at 14:53 UTC |