On Wed, 21 Mar 2012 23:31:48 +0400
Mendor <[email protected]> wrote:
> On 03/21/2012 11:27 PM, Chris Stinemetz wrote:
> > I would like to count the number of regex match and then move onto the
> > next iteration in the loop, I'm not able to get this program to work
> > as intended.
> $count = @{ [ $string =~ /(.*)/ ] };
I thing you need /g here and the more idiomatic way would be:
my $count = () = ($string =~ /$RE/g);
See:
http://www.catonmat.net/blog/secret-perl-operators/#goatse
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Escape from GNU Autohell - http://www.shlomifish.org/open-source/anti/autohell/
Sesquipedallianism: making excessive use of long words.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/