Robin Bowes skribis 2006-06-20 15:38 (+0100): > I always "use warnings" and "use strict" in all my perl code. Is that > cargo cult programming too?
No, those help catch errors. They don't change semantics. /m and /s change semantics in ways that are most of the time unneeded, and sometimes even unwanted. > > "/m" is only ever meaningful if your data has multiple lines, > ...but harmless if it doesn't, so it's good practice to use it consistently. It communicates to the reader of the code that the string is conceptually multi-line. Well, it used to, before PBP spread this nonsense. > > and "/s" makes matching [^\n] incredibly inconvenient, while that's > > a very common thing to match. > Huh? You just did it: [^\n] - any character except a newline. What's > inconvenient about that? And that's a damn sight clearer than using "." It's 6 keystrokes as opposed to just one, and it's 5 characters as opposed to just one. And it's messy if you have several of these. > and relying on the default behaviour (that "." doesn't match newlines). These defaults are reliable. They're well defined, documented, tested, and in production use for several decades. > http://perlmonks.org/?node_id=556406 Great. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html
