# Script to go through file and count the number of # times an ip appears; use strict; use warnings; my $file = 'd:\temp\text.csv'; my %hash; open (FILE, $file) or die "Can't open $file: $!\n"; while (){ my($src) = (split /,/)[1]; $hash{$src}++; } foreach my $ip (sort({$hash{$b} <=> $hash{$a}} keys %hash)) { print "$ip appears $hash{$ip} times\n"; }