in reply to Re: &&= vivify keys?
in thread &&= vivify keys?
It's because what Eliya said isn't completely true. «$x{a} &&= 1;» isn't exactly equivalent to «$x{a} = $x{a} && 1;». Specifically, «$x{a}» is never assigned to itself. What really happens:
Notice how the store is conditional? The autovivification actually occurs on fetch.
The reason your tie code doesn't behave like the non-tie code is that you didn't autovivify the inner hash on fetch like the non-tie code does (step 2). But that's excusable -- I don't know if you can even tell you were called in lvalue context.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: &&= vivify keys?
by Eliya (Vicar) on Apr 18, 2012 at 22:03 UTC |