in reply to Has Perl gone completely insane on me?
When you use & and no arguments, @_ is preserved.
sub func { print(scalar(@_), $/); } @_ = qw(a b c); &func; # 3 func(); # 0 func; # 0 &func(1, 2); # 2 func(1, 2); # 2 func 1, 2; # 2
There's rarely any need to use the ampersand notation. I think you shouldn't use it unless necessary.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Has Perl gone completely insane on me?
by ysth (Canon) on Jan 06, 2005 at 07:24 UTC | |
by Joost (Canon) on Jan 06, 2005 at 20:18 UTC |