Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: for_list and sorting key/value hash pairs

by davido (Cardinal)
on Jan 10, 2023 at 14:12 UTC ( [id://11149488]=note: print w/replies, xml ) Need Help??


in reply to for_list and sorting key/value hash pairs

for_list is certainly useful, and even for arrays. But in this case it's reasonably clear, and more concise to just use traditional pre-5.36 Perl.

my %h = map { $_, rand } 'a'..'z'; print "$_ => $h{$_}\n" for sort keys %h;

Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2025-12-06 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (85 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.