#!/usr/bin/perl use strict; my $myfile = $ARGV[0]; open FILE, "<", $myfile || die "No open $!\n"; my %hash; while () { chomp; my ($key, $val) = split /:/; $hash{$key} .= exists $hash{$key} ? ",$val" : $val; } foreach my $key (keys %hash) { print "$key = $hash{$key}\n"; }