Think about Loose Coupling | |
PerlMonks |
(zdog) Re: how to get the number of times a pattern matchedby zdog (Priest) |
on Jun 02, 2001 at 00:43 UTC ( [id://85070]=note: print w/replies, xml ) | Need Help?? |
The pattern matching function m// should return the number of times the pattern matched.
Update: Wups. My mistake. Nevermind. Update 2: However, s/// does what I thought m// does, so you can do something like: my $count = ($string =~ s/(pattern)/$1/g;) Good luck. Zenon Zabinski | zdog | zdog7@hotmail.com
In Section
Seekers of Perl Wisdom
|
|