See perlre:
NOTE: Failed matches in Perl do not reset the match variables, which makes it easier to write code that tests for a series of more specific cases and remembers the best match.
$1 and $2 have their old values from a match somewhere else in your code.
Always guard use of $1 with an if statement to make sure it matched:
if( m/(.*) <(.*)>/ ) { print "Matched '$1' + '$2'"; } else { print "Did not match"; };
In reply to Re^5: perl 5.10 bug or not?
by Corion
in thread perl 5.10 bug or not?
by sotona
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |