in reply to Pair Tag missing
Couldn't you just have a recursive sub calling itself when it finds an opening tag, and returning when it finds the corresponding closing tag ?
That way, you could report errors when you get a closing tag that doesn't correspond to the current opening tag, for example.