It sounds like you could use a SAX parser to do what you want. A SAX parser will present you with three things(or more if you want):
After you are presented with the opening or closing tag, you can decide whether the tag should be added to the current content waiting to be printed(which you store in a variable); or go ahead and print the current content, zero out the variable, and add the tag to the variable. If adding the tag to the empty variable makes it longer than the max length, then immediately print out the tag.
See XML::SAX on cpan.
In reply to Re: tags being broken in the wrong places
by 7stud
in thread tags being broken in the wrong places
by Killswit7ch8
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |