in reply to Reformat Text File
You would use a hash of arrays, as shown in perllol:
my %hash; while ( <FILE> ) { chomp; my ( $key, $value ) = split /,/ $_; # treats hashvalue as reference to an array: push @{ $hash{ $key } } , $value; } foreach my $key ( keys %hash ) { # same dereferencing as above. print "$key," , join( "," => @{ $hash{ $key } } ) , "\n"; }
Cheers, Sören
|
|---|