http://qs321.pair.com?node_id=748120


in reply to Bug? Use of uninitialized value $1 in substitution iterator

No, the regex engine has it right. Since the capturing group didn't match, $1 is undef. If $1 contained the empty string, it would mean that the associated capturing group matched a zero-length string (not possible in your example, but in general it's possible).

I don't see a reason to change the regex though, if it does what you want. Just switch off the warning.