On Wed, Aug 01, 2012 at 09:54:31PM +0200, Elizabeth Mattijsen wrote: > > With a little bit of experimenting I did manage to find one difference: > > > > $ perl -le 'sub foo (\[$@]) {}; foo $a[0]' > > $ perl -le 'sub foo (\[$@]) {}; foo @a[0]' > > Type of arg 1 to main::foo must be one of [$@] (not array slice) at -e line 1, at EOF > > Execution of -e aborted due to compilation errors. > > Wow, that's pretty obscure. I guess you *could* argue that that's a bug, but I won't :-) There's also a context difference in the way the indices are calculated: sub f { print wantarray, "\n"; 0 } $a[f()] = 1; @a[f()] = 1; which gives $ ./perl /tmp/p 1 $ -- You never really learn to swear until you learn to drive.Thread Previous | Thread Next