in reply to Dynamic HTML line too long

The odds are that it isn't the length per se, but rather that there is a character in the long lines which affects the parsing.

In any case you can use HTML::Entities and call encode_entities($javascript, "\\W") to get a version of the string to stick in the URL which should be protected from both line-breaks and unexpected interpretation of input characters.