Unless Aristotle's alias module sugestion does what you want, I think you are stuck. There is a little syntactic sugar - the -> is optional (sort of):
use strict; use warnings; my @array = qw(a b c d); printArray (\@array); sub printArray { my $aref = shift; print "First element by ref = " . $aref->[0] . "\n"; print "First element by sugar = " . $$aref[0] . "\n"; }
Prints:
First element by ref = a First element by sugar = a
Appart from that, at the end of the day I don't think aliasing is going to get you a lot except some pain. The keystrokes saved just won't add up to enough to compensate for the bugs that are bound to be introduced by obfusicating your code in that fashion - unless that is the intent of course. :)
Update: Oh, package variables. Perl does have some nasty surprises doesn't it :)
In reply to Re^5: a reference by any other name...
by GrandFather
in thread a reference by any other name...
by blogical
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |