You had syntax for something else. If number of hash elements was odd, Perl would have warned you sooner than you loose 25 minutes, it was simply bad fortune. Btw, it could be:
my %colors = %$hash{ grep /color$/, keys %$hash };
with use 5.020; to warn would-be users.
In reply to Re^2: Hash filter one-liner not working as expected
by vr
in thread Hash filter one-liner not working as expected
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |