Playing around with this, indeed, proves it can be done:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Alias;
my $hashref = { a => 5, b => 8};
alias my %hash = %{$hashref};
print $hash{a} , "\n";
prints 5. (And \%hash == $hashref evaluates true.)
I knew that Data::Alias existed -- it's mentioned in Perl Best
Practices -- but at least to me, the documentation seemed to imply
that it couldn't do this, or that it would act like "many scalar
assignments in parallel".
Thanks!
On Oct 29, 2007, at 5:33 PM, Paul Johnson wrote:
Perhaps something like Data::Alias, for example, might do the trick.
--
Aaron Priven, [EMAIL PROTECTED], http://www.priven.com/aaron
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/