my %total; my %by_file; while (<>) { chomp; $total{$_}++; $by_file{$ARGV}{$_}++; } #### my @strings = sort keys %total; for my $string ( @strings ) { print( "\t$string" ); } print( "\n" ); for my $file ( keys %counts ) { print( $file ); for my $string ( @strings ) { print( "\t$by_file{$file}{$string}" ); } print( "\n" ); }