The stupid question is the question not asked | |
PerlMonks |
Re^7: hash slice ? No thanks, I'm about to return...by Aristotle (Chancellor) |
on Feb 21, 2005 at 11:25 UTC ( [id://433019]=note: print w/replies, xml ) | Need Help?? |
Ah. Well, “lvalue” means “value which can appear on the left side of an assignment” which means “something that can be assigned to,” as opposed to a constant or some such. So “the list of lvalues assigned to” means “a list of aliases to the things you just changed.” And that is just what my examples show. You are right that one cannot assign to a key. One can create or delete keys, but not manipulate them in any way. (In fact, internally, hash keys are plain strings, not fullblown scalars. That is why you can't use references as keys and expect those keys to still work as references.) I used the join as an example of a hash slice, because slices work in assignment just as they work anywhere else. By using a hash slice you query the hash for a list of values, specified by the given list of keys, and what you get is that list of values. You can assign to that list just as you can assign to ( $foo, $bar, $baz ). Makeshifts last the longest.
In Section
Meditations
|
|