use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); print header,start_html; open LOG, '/path/to/apache/logs/access_log' or die $!; my %hist; while () { my @F = split / /, $_; $hist{$F[0]}++; } print "there are ", scalar(keys %hist), " total hits"; # just run the code and worry how it works later ;) print table( Tr(th[qw(IP Hits)]), map Tr(td[ $_, $hist{$_} ]), sort {$hist{$b} <=> $hist{$a}} keys %hist, );