in reply to Re^2: unless vs. bare block
in thread unless vs. bare block
Wait. You're saying we should write &foo and "Module::Foo"->new instead of foo and Module::Foo::->new, because they're barewords, and unfortunate? You're sure you mean this?No I didn't mean that. My characterization of all barewords as "unfortunate" was inaccurate and I thank you for pointing that out. To be more specific, I detest bareword strings, for example $x = Hello, except when playing golf and writing poetry (when I adore them). Thankfully, "use strict" disallows this particular use of barewords.
I also dislike bareword file handles, endorsing the point of view expressed in Why the Modern Perl Book Avoids Bareword Filehandles.
I prefer not to teach beginners about local and dynamic scope, at least not initially. OTOH, I do teach them about my and lexical scope in the very first lesson.
For an example of the confusion that can be caused by bareword file handles see: Bareword "FILE" not allowed while "strict subs".
For similar reasons, I feel that beginners should learn three argument open first: there are fewer gotchas and I don't want to overwhelm the beginning Perl user with many different ways to do the same thing. Rather, I prefer to teach them first what is usually the best way of doing something. I am aware that there are strong differences of opinion on this matter as indicated by this long P5P thread.
Update:
Don't scare people.Don't bully people. :) In his reply, the OP stated: "I haven't had any experience with the three-argument version" followed by "Thanks, I'll check it out". So the net result of my pointing out three-argument open was not to "scare" the OP but rather to improve his Perl knowledge and skill by encouraging him to read about three-argument open and to learn about the specific problems it solves in security-sensitive environments.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: unless vs. bare block
by JavaFan (Canon) on May 10, 2012 at 20:19 UTC | |
by eyepopslikeamosquito (Archbishop) on May 10, 2012 at 21:15 UTC |