use strict; my %count = (); # Read the stuff from STDIN while () { if (/GET .*(\.[^\s]+) ([0-9]{3})/) { my ($ftype, $reason) = ($1, $2); $count{"$ftype-$reason"}++; } } # Now print the stuff out foreach (keys(%count)) { if (/^(.*)-(.*)$/) { print "Filetype $1, reason $2 has a count of $count{$_}\n"; } } #### use strict; { local $/ = undef; # Slurp mode my $file = ; my $html = $file=~s/\.html 200//g; print "Count of HTML 200 is $html\n"; }