Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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

by leriksen (Curate)
on Feb 21, 2005 at 10:58 UTC ( #433015=note: print w/replies, xml ) Need Help??

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

Firstly, thanx Tanktalus and Aristotle for your patience in trying to get me to understand.

I think its starting to become clear. The key phrase, as from your first reply post to this, Aristole, is the list of lvalues assigned to. I dont think I really understand what that actually means - so I'll try to explain what I think it means.

Originally I thought it mean the list of keys and values, but now I see it means just the values part, not the keys. In fact assigning to a key doesnt seem to make much sense - in a hash, a key has a related value, and you can assign to that value, but you can't assign to a key. Except maybe initially, which has the effect of creating the key. I dunno, maybe my language is too loose.

The values being assigned to are the values of the keys, thats all.

That said, Aristotle, I really dont understand what your trying to show me with your examples

Why would an assignment behave differently - I understand that the values returned by the hash slice are joined, but I dont understand how the join and the assignment to a slice are related.

The aliasing behaviour isn't noise, it is exactly the point. I completely dont understand what your trying to show me ?

Sorry if I'm being thick, I think I'm getting closer if that helps. is better to be approximately right than precisely wrong. - Warren Buffet

  • Comment on Re^6: hash slice ? No thanks, I'm about to return...

Replies are listed 'Best First'.
Re^7: hash slice ? No thanks, I'm about to return...
by Aristotle (Chancellor) on Feb 21, 2005 at 11:25 UTC

    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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://433015]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2018-06-23 01:34 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.