Perl doesn't know whether you are going to use @a again in your first example. It's true that you don't use it, but the reference count doesn't actually go to zero until the end of the block, which comes after the [ @a ] construct.
But that is really beside the point: square brackets convert a list into an array ref. \@a, on the other hand, creates a reference to an array. Lists are not arrays.
In reply to Re: Why doesn't perl optimize this?
by rjt
in thread Why doesn't perl optimize this?
by nbtrap
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |