Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Re^6: hash slice ? No thanks, I'm about to return...
in thread hash slice ? No thanks, I'm about to return...

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://433019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 20:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found