use strict; use warnings; use Data::Dumper; my %hash; while () { chomp; my ( $url, $subject, $date ) = split /\t/; $hash{$url}->[0] //= $subject; push @{ $hash{$url}[1] }, $date; } local $" = ', '; print "Url|Title|Date(s)|Count\n"; for my $key ( keys %hash ) { print "$key|$hash{$key}->[0]|@{ $hash{$key}[1] }|" . scalar @{ $hash{$key}[1] } . "\n"; } print "\n", Dumper \%hash; __DATA__ http://www.perl.com Perl 01/05/10 7:44PM http://www.google.com/page?id=blah Google Search results for blah 01/05/10 7:44PM http://www.google.com/page?id=blah Google Search results for blah 05/10/12 8:12AM http://www.perl.com Perl 01/05/10 7:42AM http://www.perl.com Perl 01/10/10 9:44PMM