#!/usr/bin/perl -w use strict; my $file = 'd:/temp/file.csv'; my %hash; open(FILE, $file) or die("Can't open $file: $!\n"); while () { my ($src, $duh) = split /,/, $_, 2; $hash{$src}++; } close(FILE); foreach my $ip (sort({$hash{$a} <=> $hash{$b}} keys %hash)) { print "$ip was seen $hash{$ip} times\n"; }