use List::Util 'max'; my $selected = max grep { $find >= $_ } @array;