use List::Util qw( first ); my @readable = $s->can_read(1); for my $fh (@readable) { my $index = first { $hashes[$_]{child_fh} == $fh } 0..$#hashes; die("object not found in \$hashes!\n") if not defined $index; ... }