in reply to Conditional regex

Is'nt the second \w+ useless as the first one would match all words
No. Perl will try to match the entire regex, backtracking and reducing the match for \w+ if necessary.
This is the conditional regex (?(2)\2\1|\1). What is the the condition (2)? and secondly what is the ? before the condition .Is that to specify minimal match?
The condition (2) is true if the second set of parens matched (that is, if the second (\w+) matched), else, it's false. The ? isn't a token by itself - it's part of entire (?(condition)yes-pattern|no-pattern) syntactical construct. It's just like while, where the h doesn't carry a meaning by itself either.

Abigail