my @list; foreach my $hand ( in $ou_hand ) { next unless $hand->{Class} eq $type; push @list, $hand; }; return [ @list ]; #### [ grep { $_->{Class} eq $type } in $ou_hand ]