my $inLine = "RPC, rpc #001b, (1987)"; my $year; if ($inLine =~ /\((\d+)\)/) { $year = $1; } else { die "No year found in '$inLine'.\n"; } print "Found year '$year' in '$inLine'.\n";