Sorry... let me correect my previous mail. Try this: open(STATES,"state.txt")||die "can't open file"; while (<STATES>) { ($myval, $mykey) = split /[:\s]+/, $_; # Corrected this line from my previous mail :-) $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]