Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

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

Anything done all the time "because someone said so" is "cargo cult".

However, just because it is "cargo cult" doesn't mean it can't be a best practice. So the question more usefully becomes "Is always using xms on regexen a good idea?".

Personally I can see the justification for generally using /x and /s - they tend to avoid surprises, like when a chunk of whitespace is a tab rather than the space expected and treating all characters in a non-special way (/s) saves involving a couple of brain cells during processing more often than it requires them.

But /m is a beast of a different stripe requiring a significant switch of meaning for ^ and $. I haven't read the book (books are expensive here and Perl is something of a "sideline" for me) so I don't know the justification, but I'd be inclined to leave the /m switch off.


DWIM is Perl's answer to Gödel

In reply to Re: Best practice or cargo cult? by GrandFather
in thread Best practice or cargo cult? by robinbowes

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: (7)
As of 2024-04-19 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found