Extracting Information
$test = "You have new mail -- 12-3-01";
if ($test =~ /^You\s.+(\d+)-(\d+)-(\d+)/ ) {
print "The mail has arrived on ";
print "day $2 of month $1 in year $3.\n"; }
# Parentheses in the pattern establish
# variables $1, $2, $3, etc. to hold
# corresponding matched fragments.