in reply to Re: Aliasing hash-element and scalar? (Not Solved Yet)
in thread Aliasing hash-element and scalar?
I'm not really sure that Perl syntax allows you to alias hash entry scalars, but you can achieve the effect by using Data::Alias:
use Data::Alias; use feature 'say'; $baz{'buf'} = 'Hello'; alias $foo{'bar'} = $baz{'buf'}; say $foo{'bar'}; $foo{'bar'} = 'World'; say $baz{'buf'}; $baz{'new'} = 'old'; say $foo{'old'}; __END__ Hello World Use of uninitialized value in say at ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Aliasing hash-element and scalar? (background)
by LanX (Saint) on Sep 03, 2018 at 19:27 UTC |