my %seen; while (<$FILE>) { chomp; ++$seen{$_}; } for my $string (keys %seen) { print "$string encountered $seen{$string} time(s).\n"; }
In reply to Re: Count of patterns in a file without knowing pattern in advance
by choroba
in thread Count of patterns in a file without knowing pattern in advance
by cklatsky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |