in reply to Re: Best practice or cargo cult?
in thread Best practice or cargo cult?
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Best practice or cargo cult?
by demerphq (Chancellor) on Jun 21, 2006 at 12:51 UTC | |
by diotalevi (Canon) on Jun 22, 2006 at 04:17 UTC | |
by demerphq (Chancellor) on Jun 22, 2006 at 07:38 UTC | |
by diotalevi (Canon) on Jun 22, 2006 at 05:25 UTC | |
by demerphq (Chancellor) on Jun 22, 2006 at 07:44 UTC | |
by diotalevi (Canon) on Jun 22, 2006 at 13:40 UTC |
In Section
Seekers of Perl Wisdom