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