in reply to How do I get this reference?
FWIW, had this been an ordinary hash or an object reference for which it was really, really necessary to violate encapsulation, something like the following (shorn of bless-ed confusion) might have been served:
>perl -wMstrict -MData::Dumper -le "my %hash = (foo => {bar => {name => do { \(my $o = 'HiThere') }}}); ;; my $hash_ref = \%hash; print Dumper $hash_ref; ;; my $scalar_ref = $hash_ref->{foo}{bar}{name}; my $scalar = $$scalar_ref; print qq{'$scalar'}; " $VAR1 = { 'foo' => { 'bar' => { 'name' => \'HiThere' } } }; 'HiThere'
|
|---|