Extracting Information
$test = "You have new mail -- 5-24-99";
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.