Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: What does 'global' (/g) do in a regexp in this particular case?

by LanX (Canon)
on Apr 09, 2013 at 13:44 UTC ( #1027741=note: print w/ replies, xml ) Need Help??


in reply to Re: What does 'global' (/g) do in a regexp in this particular case?
in thread What does 'global' (/g) do in a regexp in this particular case?

> As a workaround

ehm, ok! But what for???

Can't see any benefit of using /g here.

Cheers Rolf

( addicted to the Perl Programming Language)

Update

OK at least in a loop pos works on literals...

DB<139> print scalar "a a" =~ /a/g for 1..10 1111111 # third iteration is undef than restart from beginning DB<140> print scalar "a a" =~ /a/ for 1..10 1111111111 # infinite restart


Comment on Re^2: What does 'global' (/g) do in a regexp in this particular case?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-10-31 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (217 votes), past polls