Are ALL pattern matching variables set back to undef once another m// or
s/// expression is encountered, even if it contains no parenthized
expressions?  

For example, I would have expected $1 & $2 to be valid in BOTH print
statements below...
 
#!/usr/bin/perl -w
#
$string="ABC DEF GHI JKL MNO PQR STU";

if ($string =~ /(.{7})\s+(.{7})\s+/)
{
   $p1 = $1; 
   $p2 = $2;
   print ("1 = $1, 2 = $2, p1 = $p1, p2 = $p2\n");
   
   $p1 =~ s/\s+//g;
   print ("1 = $1, 2 = $2, p1 = $p1, p2 = $p2\n");
}

Thanks,
-Dan

---
Dan Fish - [EMAIL PROTECTED] 
"A -good- dive buddy will be there if you run out of air, a -great- one will
be there before you run out!"


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to