Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

In your two additional examples (where you put $_ into the regex's) you are defeating the purpose of the 'compiled' regex. The compile option, I thought, was specifically for cases where the regex itself does *not* change.

I thought the advantage of using the qr() construct was so that the compiler would look at the regex and do the right thing...i.e., compile the regex once if it does not change, otherwise recompile every usage when it *does* change. I'm not sure what the compiler does when you tell it to compile a regex (using the /o option specifier) that is not essentially static...in fact, I vaguely recall reading that it results in unpredictable regex compiler behavior. Is that the cause of the ...different behavior... that is reported in this thread? My recollection of the compiler behavior may just be a bad memory...since I usually work hard to ensure that the regex is really static and can safely expect to compile it only onc.

I don't consider myself to be more than a novice with regex's...I'm gaining more and more experience with them and starting to drift towards that dangerous mental construct of seeing every problem as a regex waiting to birth itself. So all of the other good advice and commentary is from much more accomplished and knowledgable monks.

ack Albuquerque, NM

In reply to Re^3: Precompiling qr/.../o question by ack
in thread Precompiling qr/.../o question by vit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-20 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found