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. You cannot set them to an empty string, like you suggested. Rather, test for the success of your regex: print "digit = $1\n" if /(\d)/; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]