Hash free ! :)
#!/usr/bin/perl -l use strict; use warnings; $_ = "iowq john stepy andy anne alic bert stepy anne bert andy step al +ic andy"; print "$& => ", s/\b$&\b//g while /\w+/;
Outputs:
iowq => 1 john => 1 stepy => 2 andy => 3 anne => 2 alic => 2 bert => 2 step => 1
In reply to Re: counting words in string
by tybalt89
in thread counting words in string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |