> > I am facing a problem here. > > I am writing a script which will produce HTML output for printing. > > I want to introduce "page-break" after a specified "Content-Length" and then it continues printing the remaining input. > > Lets suppose after every 130 characters (supposing a 65 character line, after every 2 lines), how can I insert > > <DIV style="page-break-after:always"></DIV> > > and then continue printing the remaining part? > > I tried to use 'while' statement but could not think of any good solution. > > Thanks in advance for any help. > > Sara. > > ################### CODE ####################### > > $text = qq| > This is line no 1 and then it continues ..... and then a line break > This is line no 2 and then it continues ..... and then a line break > This is line no 3 and this is a long line and then it continues ..... and then a line break > This is line no 4 and then it continues ..... and then a line break > |; > > $length = length ($text); > > print qq| > <div align="center"> > <center> > <table> > <tr> > <td width="500" style="text-align: Justify" valign="middle" align="right"> > $text > </td> > </tr> > </table> > </center> > </div> > |; >
I won't guarantee style points or efficiency but how about something like: while ($text =~ /\G(.{130})/g) { print $1, $divider; } Of course there is probably a more sensible approach using boring operators like index, substr, split, and splice... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]