Is there some way in Perl that I can mention k just once on the second line:
my %k = (a=>1, b=>2, c=>undef);
say for grep{!$k{$_}} keys %k;
Make use of mapp and grepp as found in the CPAN module List::Pairwise:
use List::Pairwise qw(grepp mapp);
my %k = (a=>1, b=>2, c=>undef);
say for mapp { $a } grepp { !$b } %k;
Yes:
$b or say $a while ($a,$b) = each %k
But that's not any better (worse, IMO), so I'd stick with what you have.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With