in reply to counting words in string

What's in a name? As soon as you've figured this out (and it may not be easy), the rest of the problem is fairly simple. For clarity, the example below takes a few steps to do what could be done in a single statement.

c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dumper; ;; my $rx_name = qr{ \b [[:alpha:]]+ \b }xms; ;; my $str = 'iowq john stepy andy anne alic bert stepy anne bert andy step alic + andy'; ;; my @names = $str =~ m{ $rx_name }xmsg; print Dumper \@names; ;; my %hash; ++$hash{$_} for @names; print Dumper \%hash; " $VAR1 = [ 'iowq', 'john', 'stepy', 'andy', 'anne', 'alic', 'bert', 'stepy', 'anne', 'bert', 'andy', 'step', 'alic', 'andy' ]; $VAR1 = { 'john' => 1, 'stepy' => 2, 'alic' => 2, 'bert' => 2, 'andy' => 3, 'step' => 1, 'anne' => 2, 'iowq' => 1 };


Give a man a fish:  <%-{-{-{-<