while (<IN>) { s{(<tgroup cols="(.*?)">)}{ "$1\n" . (map { "<colspec colnum='$_' colname='$_'/>\n" } 1..$2) }eg; print OUT; } [download]
In reply to Re: for loop by ikegami in thread for loop by texuser74