use List::Util qw(first); my $match = first {$_->pid == $wanted} @{$p->table};