Help for this page

Select Code to Download


  1. or download this
    my $str = 'this is some text 1989 blah';
    my $year;
    $year = $1
        if( $str =~ /\b((?:19|20)\d\d)\b/ );
    
  2. or download this
    sub find_year {
        my( $str ) = @_;
    ...
            if( $str =~ /\b((?:19|20)\d\d)\b/ );
        return $year
    }