in reply to regex matching issue

Do I understand you the if is true but $3 doesn't get printed?

Without knowing the whole file I would recommend changing (.*) to (.+?) meaning "match at least one character but non-greedy"!

In general you should consider using one of the XML-moduls on CPAN...

Cheers Rolf