Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Using 'keys' on a list

by tybalt89 (Monsignor)
on Jun 29, 2021 at 18:40 UTC ( [id://11134459]=note: print w/replies, xml ) Need Help??


in reply to Using 'keys' on a list

At 5 characters

my @keys = keys %{{f}};
is much more elegant than the equivalent
use List::Util qw( shuffle uniq pairkeys ); my @keys = shuffle uniq pairkeys f;
Remember that hashes do uniq'ing and shuffling for free :)

UPDATE: added a missed "keys" as LanX pointed out.

Replies are listed 'Best First'.
Re^2: Using 'keys' on a list
by LanX (Saint) on Jun 29, 2021 at 19:59 UTC
    >   my @keys = %{{f}};

    Did you mean:

      my @keys = keys %{{f}};

    ???

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      sure did, updated.

      Apparently. But that's exactly what the OP was using, so it doesn't help.

      Seeking work! You can reach me at ikegami@adaelis.com

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found