Do you know where your variables are? | |
PerlMonks |
Re^2: Delimited Backtracking with Regexby ikegami (Patriarch) |
on Apr 21, 2006 at 02:26 UTC ( [id://544760]=note: print w/replies, xml ) | Need Help?? |
I've been asked why I used a package variable instead of a lexical variable. It's because regexps close around the lexicals that exist when they are first run.
A variable called @matches is created everytime test is called. The regexp always uses the variable from the first call.
In Section
Seekers of Perl Wisdom
|
|