in reply to Need help with a simple perl script
Getting the same output that you wanted!
And i think the code you have given needs slight modification:
1. for loop to be included in while
2. $_="|" for $"="|"
(I know you knew these :-))
Here I have modified.
my %c; while( <> ){ chomp; my($c2,$c4,$c12)=(split/\|/)[1,3,11]; $c{"$c2|$c4"}||=[$_,0]; ++$c{"$c2|$c4"}[1] if $c12=~/\S/; $_="|"; for( sort keys %c ){ print "@{$c{$_}}\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Need help with a simple perl script
by choroba (Cardinal) on May 23, 2012 at 12:07 UTC | |
by uday_sagar (Scribe) on May 24, 2012 at 11:41 UTC | |
by choroba (Cardinal) on May 24, 2012 at 11:56 UTC |
In Section
Seekers of Perl Wisdom