Help for this page

Select Code to Download


  1. or download this
    my $inLine = "RPC, rpc #001b, (1987)";
    my $year;
    if ($inLine =~ /\((\d+)\)/) {
    ...
      die "No year found in '$inLine'.\n";
    }
    print "Found year '$year' in '$inLine'.\n";
    
  2. or download this
    my $inLine = "RPC, rpc #001b, 1987";
    
    $inLine =~ /(#\d+[a-z])/;
    ...
    $inLine =~ /\((\d+)\)/;
    my $year = $1;
    print "Found year '$year' in '$inLine'.\n";
    
  3. or download this
    Found rpc num #001b in RPC, rpc #001b, 1987.
    Found year #001b in RPC, rpc #001b, 1987.