[ale] OT perl hash help

David Hamm ale at spinnerdog.com
Mon Aug 4 09:44:41 EDT 2008


Hi,

I'm trying to copy a hash from a hash reference and failing.  Could someone 
offer some guidance off line?  Thanks.

# print a value in the original Hash Ref 
print "$FC->{ IpConfig }{ BCA }\n";  

# try to copy the hash ref to a has
my( %hcopy ) = %$FC;
my( $hcopyref ) = \%hcopy;

print "$FC\n";
print "$hcopyref\n";

This bit of code produces:
HASH(0x26892c)
HASH(0x113bc4)

But $hcopyref->{ Ipconfig }{ BCA } = 50;  changes the value in both hashes.

Thanks


More information about the Ale mailing list