Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Hash filter one-liner not working as expected

by Dallaylaen (Chaplain)
on Mar 17, 2019 at 18:06 UTC ( [id://1231371]=note: print w/replies, xml ) Need Help??


in reply to Hash filter one-liner not working as expected

I wonder if there's a hash filter function somewhere, as in:

my $new_ref = filter_hash { $a =~ /color/ and !ref $b } $hashref;

Where $a is each key and $b is the corresponding value. Seems trivial to write, so it must exist.

UPD: Here: Hash::MostUtils - called hashgrep.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2024-04-19 00:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found