my %total; my %by_file; while (<>) { chomp; $total{$_}++; $by_file{$ARGV}{$_}++; }