Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Re-use of a global match

by shmem (Chancellor)
on Aug 01, 2007 at 10:48 UTC ( [id://630015]=note: print w/replies, xml ) Need Help??


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

Do gube's original question and the fine answers above not point also to some optomization (a single instance in the symbol table of the two identical if...} clauses?

No*. It all has to do with match positions not being reset until a match failed, if /g is in effect.

Without /g, those internal state variables are reset before each match; with /g, they are reset after a match failed.

*) which doesn't mean there isn't such optimization, merely that the behaviour gives no evidence about that.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2026-04-10 23:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.