in reply to Conditional regex

Well, i can't figure it out myself, but add use re "debug"; in the script and it will cause regex to print out debug, which might give more clues.

Ps. The (2) checks whether the second backreference exists. Why it isn't (\2) i don't know (it just reads so in camel book:)).