in reply to hash ref mind blow
Prints:use strict; my %hash = (); $hash{a}{drinks}=1; $hash{b}{drinks}=2; my $p = \%hash; my %copy = %{ $p }; print "ref hash: ", \%hash, "\nref copy: ", \%copy, "\n"; print "values hash: ",join(", ", values %hash), "\nvalues copy: ",join +(", ", values %copy), "\n";
Note that the values are identical, and thus the values of %hash and %copy refer to the same hash references.copy: ab hash: ab ref hash: HASH(0x82ef7d8) ref copy: HASH(0x82ef928) values hash: HASH(0x82e0308), HASH(0x82ef788) values copy: HASH(0x82e0308), HASH(0x82ef788)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: hash ref mind blow
by Anonymous Monk on Sep 24, 2008 at 16:51 UTC | |
by Corion (Patriarch) on Sep 24, 2008 at 16:53 UTC | |
by ikegami (Patriarch) on Sep 24, 2008 at 21:39 UTC | |
by Anonymous Monk on Sep 25, 2008 at 08:55 UTC | |
by JadeNB (Chaplain) on Dec 28, 2009 at 00:11 UTC |