zork42 has asked for the wisdom of the Perl Monks concerning the following question:
I accidentally typed "my ($x) = @);" instead of "my ($x) = @_;"
Shouldn't the former have generated a syntax error?
I suspect I've missed something obvious, but I can't see what!
Shouldn't the former have generated a syntax error?
perlvar.html says there is a "$)" variable, but "@)" is not mentioned.use strict; use warnings; foo(1); sub foo { my ($x) = @); # why doesn't this generate a syntax error? print $x; } # Program Output: "Use of uninitialized value $x in print at test.pl l +ine 9."
I suspect I've missed something obvious, but I can't see what!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Why doesn't "my ($x) = @);" generate a syntax error?
by tobyink (Canon) on Jun 13, 2013 at 06:50 UTC | |
by Grimy (Pilgrim) on Jun 13, 2013 at 17:57 UTC | |
by tobyink (Canon) on Jun 13, 2013 at 23:31 UTC | |
by zork42 (Monk) on Jun 13, 2013 at 06:57 UTC |
Back to
Seekers of Perl Wisdom