in reply to Re: I have a hash in a hash in a .....
in thread I have a hash in a hash in a .....
Read-only result? I'm not sure what you mean by that, but if you assign to an element of $r, that affects $my_hash_ref. They're all references so they're pointing at the same data.
#!/usr/bin/perl use Data::Dumper; my $hash = { a => { ab => { ac => 'fred' }, abb => 'barney' }, b => 'betty', c => { cb => 'dino' }, }; my $r = $hash; my @k = qw( a ab ); print Dumper( $hash ); $r = $r->{$_} foreach @k; $r->{ 'ac' } = 'Mr. Slate'; print Dumper( $hash );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: I have a hash in a hash in a .....
by ikegami (Patriarch) on Feb 21, 2006 at 20:37 UTC | |
by brian_d_foy (Abbot) on Feb 21, 2006 at 20:50 UTC | |
by ikegami (Patriarch) on Feb 21, 2006 at 20:57 UTC |