in reply to
Re: split question
in thread split question
A slightly more readable version might be:
my $inLine = "RPC, rpc #001b, (1987)";
my ($year) = $inLine =~ /\((\d+)\)/;
die "No year found in '$inLine'\n" unless defined $year;
The reason for checking defined
ness is because of the potential for an erroneous year zero. (You might want to die on year 0 ... I dunno.)
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.