in reply to how to loop through?

while(/<tc>/)

If you write the regexp as

/<tc ( [^>]+)? >/x
you can distinguish: If $1 afterwards is undef, you had only a <tc>. If $1 is defined, it contains what comes after the <tc.

-- 
Ronald Fischer <ynnor@mm.st>