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

Re: Re: Testing a string for a range of characters

by Fastolfe (Vicar)
on Jan 24, 2001 at 20:35 UTC ( [id://54024]=note: print w/replies, xml ) Need Help??


in reply to Re: Testing a string for a range of characters
in thread Testing a string for a range of characters

This is incorrect. The regex is compiled only once so long as its contents have no interpolated variables. The /o flag does nothing in this case.

Replies are listed 'Best First'.
Re: Re: Re: Testing a string for a range of characters
by dsb (Chaplain) on Jan 26, 2001 at 21:29 UTC
    Ummmm. It most certainly does :D. There is no variable interpolation going on this Regex. Not the one I put up there anyway. Point it out if you don't mind. - kel -
      I don't understand.. I was noting that the /o flag is only useful for compiling a regex once, to avoid recompiling it later. However, this is only a factor if the regex has an interpolated variable. In other words, if Perl notices that the regex will be constant between calls, it will just compile it once anyway. The /o flag does nothing in this case. If Perl sees any interpolated variables, it has to assume that this variable may be different between regex tests, so it recompiles it every time, unless the /o option is given.
        I concede. I was under the impression that Perl constantly re-compiles expressions unless the 'o' modifier is there. I have to read up on it and refresh my memory, but for now...I concede ;) - kel -

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-28 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found