Help for this page

Select Code to Download


  1. or download this
    use List::Util 'max';
    my $selected = max grep { $find >= $_ } @array;
    
  2. or download this
    # Find the largest number in @array
    # that is <= $find and put it in $selected
    ...
                              and $number >  $selected;
        last if defined $selected and $selected == $find;
    }