$ perl -wMstrict -MData::Dump -le 'my %h=("a".."j"); my $x=sub{\@_}->(@h{"c","e","g"}); $_=uc for @$x; dd \%h' { a => "b", c => "D", e => "F", g => "H", i => "j" }