open (FILE,"c:/file.txt"); %hash=(); while () {chomp; split /:/; if ($hash{$_[0]}){$hash{$_[0]}.=",$_[1]";} else {$hash{$_[0]}=$_[1];} }