dereferencing
- From: aaron@xxxxxxxxxx (Aaron Priven)
- Date: Mon, 29 Oct 2007 16:23:32 -0700
I can do this:
my $hashref = \%hash;
But as near as I can tell, there is no way to do the reverse operation: making a "my %hash" that is an alias for a hash reference.
It's possible with a package variable:
#/usr/bin/perl
our %hash;
my $hashref = { a => 5 , b => 8 };
*hash = $hashref;
print $hash{a};
that prints "5". But there's no way to do this with a lexical (my) variable.
is this right?
--
Aaron Priven, aaron@priven,com, http://www.priven.com/aaron
- Follow-Ups:
- Re: dereferencing
- From: John W . Krahn
- Re: dereferencing
- From: Tom Phoenix
- Re: dereferencing
- From: Jeremy Kister
- Re: dereferencing
- Prev by Date: Re: Hash of array
- Next by Date: Re: dereferencing
- Previous by thread: SoapLite Error
- Next by thread: Re: dereferencing
- Index(es):
Relevant Pages
|