Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^3: Hash assignments using map

by japhy (Canon)
on Feb 25, 2007 at 14:03 UTC ( #601996=note: print w/replies, xml ) Need Help??

in reply to Re^2: Hash assignments using map
in thread Hash assignments using map

Right. My point is, why not loop over the elements in @keepers, rather than the keys of the other hash?
my %big_hash = (...); my @to_keep = ('abc', 'xyz'); %big_hash = map { exists($big_hash{$_}) ? ($_ => $big_hash{$_}) : () } + @to_keep; # or %big_hash = map { $_ => $big_hash{$_} } grep { exists $big_hash{$_} } +@to_keep;

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://601996]
[marto]: hippo yes, but the list of exceptions (Section 17 IIRC) is open to interpretation
[Corion]: For small businesses, there isn't much to do IMO, as long as you don't outsource anything and don't employ third parties (like Google Analytics, or mailing list services/ advertising services etc.)
[Discipulus]: hippo you'll need a malox after each paragraph..
[marto]: Corion so say a mailman mailing list? This falls under exceptions, there's nothing private stored on a public mailing (well, discussion) list, rather than a marketing list
[choroba]: isn't an email address a private thing?
[marto]: if you send email to a mailing list, that's published

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2018-05-22 08:04 GMT
Find Nodes?
    Voting Booth?