Help for this page

Select Code to Download


  1. or download this
    use List::Util qw( first );
    
    my $picture = first { /$match/ } sort @pictures;
    
  2. or download this
    my $picture = do {
        my @candidate = sort @pictures;
        shift @candidate while @candidate and $candidate[0] !~ /$match/;
        shift @candidate;
    };