in reply to Re: A regex BR variable dead in following line/command
in thread A regex BR variable dead in following line/command
Indeed, the idiomatic expression is rather
while( m/REGEX/g ) { ... # use groups only if match successful }
The only reason to check $2 separately, is to make sure it's not false ( "", 0, undef, etc )
this can be done with
while( m/REGEX/g ) { last unless $2; ... }
tho I doubt the OP is aware of all those false cases.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|