in reply to Re^2: Question on Regex grouping
in thread Question on Regex grouping

http://search.cpan.org/~jesse/perl-5.12.2/pod/perlre.pod#Capture_buffers
The numbered match variables ($1, $2, $3, etc.) and the related punctuation set ($+, $&, $`, $', and $^N) are all dynamically scoped until the end of the enclosing block or until the next successful match

Out of curiosity,what do I have to do if I need to print the 5 digit number in the first regex as well?

store it, or print it before performing another match operation