in reply to Counting the Number of Times and IP Appears

Would it not be easier to say something to the effect of (*warning: untested code*):

#!/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 (<FILE>) { 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"; }

The code assumes that you are only taking the first item out of each line, discarding the rest. When you do $hash{$src}++, it is created as a value of zero and incremented if it doesn't exist, or incremented if it does.

Hope that helps....