Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Why does 'keys' need a named hash?

by vrk (Chaplain)
on May 22, 2017 at 08:45 UTC ( #1190845=note: print w/replies, xml ) Need Help??

in reply to Re: Why does 'keys' need a named hash?
in thread Why does ‘keys’ need a named hash?

I just noticed there are functions for this in List::Util: pairkeys and pairvalues. For example:

use v5.14; use List::Util qw(pairkeys pairvalues); my @a = qw(a b c d e f); say "keys = ", join ", ", pairkeys @a; say "values = ", join ", ", pairvalues @a; my %h = @a; say "keys = ", join ", ", keys %h; say "values = ", join ", ", values %h;

The obvious difference to keys and values of a hash is that pairkeys doesn't remove duplicates and it keeps the original array order.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-01-26 09:16 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (69 votes). Check out past polls.