SyntaxFix
Write A Post
Hire A Developer
Questions
This could be done using List::Util's first function:
first
use List::Util qw/first/; my @array = qw/foo bar baz/; print first { $_ eq 'bar' } @array;
Other functions from List::Util like max, min, sum also may be useful for you
List::Util
max
min
sum