http://www.perlmonks.org?node_id=187485


in reply to Re: Infinite loop regex
in thread Infinite loop regex

Minor Nitpick:

Why bother with the redundent @list?

$string = 'a=111a=222a=333'; for ($string =~ m/(a=\d+)/g) { print "$_\n"; # any other code }

Replies are listed 'Best First'.
Re: Re: Re: Infinite loop regex
by rjray (Chaplain) on Aug 04, 2002 at 23:03 UTC

    For that matter, if you are grouping all the matches at once, why bother with the temporary string?

    for ($obj->method =~ /pat(keep)/g) { print $count++, " $_\n"; # etc. }

    --rjray