Wouldn't you expect the same behavior if you just used $h{'a'} or @h{qw(a c e)}?
Yes, I would expect that (I thought about this before posting). Assigning to $h{x} is ... the way to set a hash element. Also assignments to hash slices are common and widespread. But, could you show me any published code (CPAN module, etc., even obfu will do) that uses the lvalueness properties of a flattened hash? Would you rely on this in your own code?
It'd surprise the hell out of me if it didn't behave this way.
Flattened hashes were read-only lists created on the spot, on my mental map, until I found otherwise. It makes sense to me - and it doesn't. It's somewhere on the borderline. That's why I'm seeking wisdom.
Also, please note, the point of my OP is not about arguing that Perl should do this or that -- all expressed opinions are IMHO. I'm just seeking an authoritative answer.
To conclude, your opinion falls into for the sake of consistency, right?
In reply to Re: Re: LVALUEness in flattened hashes
by calin
in thread LVALUEness in flattened hashes
by calin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |