From: Ron Newman <[EMAIL PROTECTED]>
Date: Tue, 20 Apr 2004 23:06:12 -0400
If I try to match a regular expression that contains parentheses, and
the match fails, shouldn't $1 be set to undef rather than keeping
whatever value it had before?
Nope. It will still have its old value, so you need to check whether
the match succeeded:
if ($s =~ /There are (\d+) words./) {
print "sub1 (before call): \$1=$1\n";
} else {
print "I didn't match anything\n";
}
Linda
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm