yes I agree I was a little ambiguous... I was in a hurry. sorry. Anyway
Then do it at a later time and do it right, I imagine most all of us are busy also :)
here is my updated code. and here is a sample output: My goal is to get all F01 which I am but I am having issues capturing all
Then you're doing a rube goldberg if that is indeed what you're trying to do:
# untested and prolly even more efficient way but it # illustrates enhancements to the original code
#!/usr/bin/perl use strict; use warnings; use Data::Dumper;
$ENV{PATH} = '/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log'; open V4, 'samcmd v4 2>&1 |' or die "unable to open pipe: $!";
my @last_col; for(<V4>) { chomp; my @tmp = split /\w+/; push @last_col, $tmp[ $#tmp ]; }
close V4; print Dumper [EMAIL PROTECTED];
now @last_col has all of the F01... pieces of data.
of these values into my array. When I run the I get the data I want to see which is just the F01 column, but when I comment out line 14 and uncomment line 15 and uncomment line 21 I see no data in the array??? In the end I want the F01 column and the % column.
thank you,
derek
1 2005/01/20 15:39 17 2% -il-o-b- - - - - sg F01000 2 2005/01/20 15:53 14 1% -il-o-b----- sg F01001 3 2005/01/18 09:53 2 0% -il-o-b----- sg F01002 4 2005/02/04 16:41 196 100% -il-o-b----f sg F01003 5 2005/02/05 21:13 305 100% -il-o-b----f sg F01004 6 2005/02/28 22:47 180 100% -il-o-b----- sg F01005 13 2005/02/08 16:07 112 100% -il-o-b----f sg F01006 14 2005/02/09 21:56 122 100% -il-o-b----f sg F01007 15 2005/02/11 10:51 147 100% -il-o-b----f sg F01008 16 2005/02/13 11:35 193 100% -il-o-b----f sg F01009 17 2005/02/14 23:46 79 100% -il-o-b- - - -f sg F01010
#!/usr/bin/perl 1> use strict; 2> use warnings; 3> $ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log); 4> open (V4, "samcmd v4 2>\&1 |" ) || die "unable to open pipe... Broken? $!";
Whay double quote/qq() all of that when no quotes or single quotes are better?
also
"or die" is more preferable than "|| die"
5> my @fa =(); 6> my @ha =();
my @fa; my @ha;
the = () isn't necessary and doesn't keep you from getting uninitialized value warnings like you think it does, thats only scalars.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>