Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Consise way to filter out keys with undef values from a hash slice?

by jo37 (Deacon)
on Jun 02, 2020 at 19:05 UTC ( [id://11117603]=note: print w/replies, xml ) Need Help??


in reply to Re: Consise way to filter out keys with undef values from a hash slice?
in thread Consise way to filter out keys with undef values from a hash slice?

Otherwise (ab)using hashes for set operations like intersections would be trivial.

Though off-topic here: Is there a common idiom for an intersection of two hash-sets? The first thing that comes to my mind is something like:

%a_b = map {exists $b{$_} ? ($_ => $b{$_}) : ()} keys %a;

Greetings,
-jo

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
  • Comment on Re^2: Consise way to filter out keys with undef values from a hash slice?
  • Download Code

Replies are listed 'Best First'.
Re^3: Consise way to filter out keys with undef values from a hash slice?
by LanX (Saint) on Jun 02, 2020 at 22:54 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-25 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found