Is there a Perl idiom for finding the item in an array that meets a specific criteria if there is one?
my $match = 0;
foreach(@list){
if (match_test($_)){
$result = $_;
$match = 1;
last;
}
}
$match || die("No match.");
say $result, " is a match.";
The example seems a bit awkward. I expect Perl to have something to handle this more cleanly.