in reply to LVALUEness in flattened hashes
I've read your post and the replies to it so far and I confess that I haven't a clue as to what you're talking about (though others appear to). You seem to be amazed at two separate perl constructs:
Either way you look at it, @_ will contain aliases for each element of %hash in foo(%hash) and $_ (or whatever you've named your loop variable) will alias each element of %hash in for (%hash) { ... }. It has nothing to do with the fact that you've stuck a hash in those places. It would do exactly the same thing if you stuck an array there instead (other than the keys of a hash are immutable while there is no such restriction on an array). Or if you'd stuck any other list of scalars in there instead. The only wrinkly bit is that the scalars that correspond to hash keys are immutable.
What it sounds like you mean by "lvalueness in flattened hash" is that (%hash)[$_] .= "_mod" for 0..(keys %hash) should work just like $_.="_mod" for %hash. But that obviously won't work.
|
|---|