|
|
| There's more than one way to do things | |
| PerlMonks |
Re^2: Best practice or cargo cult?by Juerd (Abbot) |
| on Jun 20, 2006 at 15:00 UTC ( #556417=note: print w/ replies, xml ) | Need Help?? |
|
As I understand it, these options will all effectively be turned on by default in the Perl 6 regex engine. So either Larry has decided that they are, in fact, best practice or Damian has sneaked them into the specs whilst Larry wasn't watching. Firstly, Perl 6 is not Perl 5. Secondly, Perl 6 gives you \N, a convenient way to write <-[\n]> (that's [^\n]). It's worse than ., but acceptable. Writing [^\n] all the time is a hard exercise for one's fingers, and makes for messy code. That's why I strongly believe you should only use /s when you really want . to include the newline character. /m won't be turned on by default in Perl 6. Instead, we get different metacharacters for begin/end of line versus string. So again it gives best of BOTH worlds. As for /x... I have no strong opinion about that. I don't think /\A\d+\z/ is unreadable, but I don't mind /\A \d+ \z/x at all.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||