Got it. I'll still stick with what I said, though. This "feature" offered by Perl prototypes strikes me as primarily a seed of confusion.
Confusion? You should read 6th Apocalypse by Larry Wall and the appropriate Exegesis by Damian Conway:
http://dev.perl.org/perl6/apocalypse/A06.html http://dev.perl.org/perl6/exegesis/E06.html
Now, _that_ is confusing. :)
But seriously, I see you point. Perl 5 prototypes were invented mostly to make things like $x = pop @array work but there is nothing you can do with prototypes which you cannot do without them, only with different function call syntax.
Particularly in the context of a beginners list, it obscures the underlying issue concerning subroutine arguments--that subroutines take only a list of scalars as their arguments. When we have so many beginners tripping themselves up by trying to avoid the use of explicit references, this syntactic "convenience" only prolongs the pain and confusion.
True. This is probably one of those parts of Perl which should not be the first thing told beginners.
I must say, this is clearing up a point of cusiosity for me, as to how functions like chomp @lines; can work on the original structure as called.
Yes. This, and e.g. things like this:
print int $x, int $y;
with int, unlike print, acting as a unary operator and getting only one argument, thanks to its ($) prototype.
I would see this in a more positive light, perhaps, if prototypes were more required for all functions, particularly if they offered named formal parameters.
They will in Perl 6.
http://dev.perl.org/perl6/ -- ZSDC
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>