my %h = (); while(<>) { chop; my @fld = split( /\|/ ); my $key = shift @fld . "|" . shift @fld; $h{ $key } &&= $h{ key } . ','; $h{ $key } .= shift @fld; shift @fld and die "Analysis error: too many fields $_\n"; } for my $k ( keys %h ) { print $k . '|' . $h { $k } . "\n"; }
Everything but the troll
In reply to Re: amalgamate similar lines
by DungeonKeeper
in thread amalgamate similar lines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |