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
    There's rarely any need to use the ampersand notation. I think you shouldn't use it unless necessary.
    Some people feel more comfortable using &. It leads to less action at a distance (where perl parses differently depending on whether it's already seen a sub declaration). But if you do choose to use &, always use () with it.