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

Re^3: Re-use of a global match

by mrpeabody (Friar)
on Aug 02, 2007 at 05:00 UTC ( [id://630214]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Re-use of a global match
in thread Re-use of a global match

/g can be useful. But if you just want to know if something matches (which for me is most of the time), you don't need it.

The cases where m///g is useful are where:

  • you need to save the position of the last match, or
  • you're counting or saving the matches for later use (assigning the result of m/// to a variable)

In practice, I find myself using /g only in substitutions.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-24 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found