my @wants = grep { is_approximately_an_integer( @$_ ) } values %haystack; # intervening comments here only @wants = grep { is_approximately_an_integer( @{$haystack{$_}} ) } keys %haystack;