Thanks for giving insight of the solutions and giving me prototypes to copy and paste ;)
And the other problem is that $& only shows the actual most recent match, not some count of the number of possible timesActually that is what I mentioned pl read comments in
Now, I posted this piece to get suggestion from people, what in regular expression can be used (in place of $&) But it can be done using spl variable of reg ex also, if I am right?? Any takers?#! /usr/bin/perl use strict; use warnings; my $x=1; my @arr= qw(foo cho roh foo kho foo moo foo); my $str=join ' ',@arr; $str=~ /foo/; print $&; #### In place of $&; we can use that for no #### for no. of matches.
to count the no of matches in one go using special variable, if there is any!! and I think I encountered that somewhere!
In reply to Re^3: Word frequency in an array
by cool
in thread Word frequency in an array
by monkeybus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |