Hi all,
Paul Johnson wrote:
On Tue, Sep 30, 2008 at 11:40:21AM -0400, Mr. Shawn H. Corey wrote:
No.
Inside a sub, shift without a parameter will shift @_. Outside a sub,
it will shift @ARGV. Since it does two different things in different
context, always give it a parameter. Things that do different things
should look different.
No.
Or, more charitably, your first two sentences are (mostly) correct but I
think you might find yourself fighting a losing battle with the last
two, both philosophically and with your specific suggestion.
I have to admit that it is quite nice that Perl has defaults, but
(IMHO), shouldn't you be programming in an explicit manner first and
when you become confident in the language, then start leaving things out?
A beginner in Perl "should" be explicit when they program...it may be
redundant, but with the current pricing of disks, those few extra bytes
won't hurt and it helps them remember what the defaults are. It is as
absurd as how beginning C/C++/Java programmers are taught to initialize
everything to 0, even though some compilers do that for them
(nowadays). But teachers and professors encourage this and even deduct
marks for not doing it.
Maybe there should be a separation between "what Perl programming
practices you would suggest to a beginner" and "what you do yourself"...
Ray
PS: I don't think Shawn is fighting a losing battle...at least I agree
with him...maybe I'm on the "losing side". :-)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/