Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Infinite loop regex

by tlhf (Scribe)
on Aug 04, 2002 at 13:43 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-20 15:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found