But, don't use the commandline flags in a production script! Good Gods, man, are you trying to get the OP to write obfuscated code?!? Who looks at the shebang line?Well, I think that -l is safe enough in short enough scripts. So it all depends on how short the production script will be, and of course a "production script", whatever it could be, tends to give the idea of being a rather longish thing, or if it is not, it's still likely to grow into one, so I think that you're right in the vast majority of cases.
I think I have a tendency to overuse -l myself, because I like not to have to include literal newlines. But then when I want both this and to be safe I do
{ local $\="\n"; # or $/, if it's not been changed... print whatever; print something_else; # ... }
Of course if we had Perl6's say() we wouldn't be bothered, but then someone will certainly point out that we already have a module for that. OTOH, IMHO it could easily leak into the core in some next major perl5 release, couldn't it?
In reply to Re^4: printing a scalar as an array
by blazar
in thread printing a scalar as an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |