in reply to Reference optimization (alias/glob)

That's because local only works on package variables, not dynamic ones. Since you don't have a package variable named @aref, you get an error. You can do a couple of things. Either declare the package variable with use vars or our, or explicitly use it as a package variable (and lose the benefits of strict).

use strict; my(@array) = qw(one two three four five); duhbub(\@array); sub duhbub { local(*aref) = shift; print("$::aref[1]\n"); }

I wouldn't do this, though. The local *aref trick was primarily for Perl 4 programmers as a hack to get around lack of references by using typeglobs rather than the entire data structure. You could then use typeglobs inside of your data structure to simulate complex data structures. Now we have references so there's no need for the hack.

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil