On Mon, Jul 21, 2003 at 10:34:59AM -0400, Jeff 'japhy' Pinyan wrote: > On Jul 21, Ed Christian said: > >> I assumed that, $1 would be reset (either undefined or set to null) once >> I exited the scope of the while loop my regexp was called in. Sadly, I >> was mistaken. :) Below is a test example of code I wrote, with $1 values >> differing from those I expected. Do I need to explicitly set $1..$n to >> an empty string before every regexp if I'm to test based on the results >> of that regexp? > > You assumed wrong. :) > > The documentation states that the $DIGIT variables are set after > each SUCCESSFUL pattern match. If a regex fails to match, the $DIGIT > variables retain their previous value.
The docs also claim that the digit variables will be "dynamically scoped to the current BLOCK", which isn't quite accurate, and is presumably what confused Ed. We could ammend it to say: Perl's notion of the "last successful match" is dynamically scoped. But, as demonstrated, that's not completely accurate either, since PL_curpm isn't restored on loop iteration. -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]