in reply to Count of patterns in a file without knowing pattern in advance

This is a FAQ.
my %seen; while (<$FILE>) { chomp; ++$seen{$_}; } for my $string (keys %seen) { print "$string encountered $seen{$string} time(s).\n"; }

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]