Help for this page

Select Code to Download


  1. or download this
    my $LEN = 8; # Desired length
    my $match;
    ...
    }
    die "Didn't find a match" if not defined $input;
    print "First match: '$match'\n";
    
  2. or download this
    use List::MoreUtils 'firstval';
    my $match = firstval { chomp; $LEN == length } <STDIN>;