Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Best practice or cargo cult?

by GrandFather (Cardinal)
on Jun 20, 2006 at 21:04 UTC ( #556528=note: print w/ replies, xml ) Need Help??


in reply to Best practice or cargo cult?

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


Comment on Re: Best practice or cargo cult?
Re^2: Best practice or cargo cult?
by sgt (Chaplain) on Jan 28, 2007 at 22:43 UTC

    I agree. There is also another problem I see; as the ms flags have been used much less, it is possible they are buggier. Quite a few optimization bugs have been found in the m case (and some discussed here actually).

    cheers --stephan

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-12-20 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls