Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Problem with HOA.

by cog (Parson)
on Aug 28, 2006 at 07:10 UTC ( #569939=note: print w/replies, xml ) Need Help??


in reply to Problem with HOA.

my @array = map { $hash{$_}->[0] } sort { $a <=> $b } keys %hash;

That's the first solution that comes to my mind. Try reading it backwards:

    1. Take the keys of the hash... (keys %hash)
    2. ...sort them numerically... (sort { $a <=> $b } ...)
    3. ...and get the first element of the array corresponding to each key in the hash... (map { $hash{$_}->[0] } ...)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://569939]
help
Chatterbox?
[LanX]: oh 9 downvotes ... Nick must be back :)
[marto]: https://www. youtube.com/watch? v=WZnsHvEYEZI
[Discipulus]: marto apotropaic gestures in Eataly..
[Discipulus]: LanX nick does not downvote peoples, just content he dislike (I think)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2018-04-26 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?