Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Infinite loop regex

by tlhf (Scribe)
on Aug 04, 2002 at 13:43 UTC ( #187485=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://187485]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2021-09-25 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?