Why don't you try this:


open(STATES,"state.txt")||die "can't open file";
while (<STATES>) {
   ($mykey, $myval) = split /\s+/, $_;
   $myhash{$mykey} .= $myval.', ';
}
close STATES;

# Let's write the output
foreach $loopkey (keys %myhash) {
   $myhash{$loopkey }=~s/,\s$//; # Remove last comma and space
   print $loopkey.' '.$myhash{$loopkey}."\n";
}



Ciao...
        Alessandro Cavallari

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to