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 times
Actually that is what I mentioned pl read comments in
my @arr= qw(foo cho roh foo kho foo moo foo);
my $str=join ' ',@arr;
print $&; #### In place of $&; we can use that for no
#### for no. of matches.
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?
to count the no of matches in one go using special variable, if there is any!! and I think I encountered that somewhere!