in reply to for loop

while (<IN>) { s{(<tgroup cols="(.*?)">)}{ "$1\n" . (map { "<colspec colnum='$_' colname='$_'/>\n" } 1..$2) }eg; print OUT; }

Replies are listed 'Best First'.
Re^2: for loop
by texuser74 (Monk) on Aug 11, 2008 at 07:39 UTC
    hi, thanks for your time and help
    but the code
    while (<IN>) { s{(<tgroup cols="(.*?)">)}{ "$1\n" . (map { "<colspec colnum='$_' colname='$_'/>\n" } 1..$2) }eg; print OUT; }
    just prints <table><tgroup cols="3">3</table>
      Oops!
      while (<IN>) { s{(<tgroup cols="(.*?)">)}{ "$1\n" . join('', map { "<colspec colnum='$_' colname='$_'/>\n" } 1..$2) }eg; print OUT; }
        ikegami, thanks for your help. now it works fine for me.