Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

formatting perl code (literally)

7:10 pm on Sep 4, 2003 (gmt 0)

10+ Year Member


I am trying to work on a script that is one long line in its entirety with over 260,000 characters!

Is there a module or an application that can format the script so it will be human readable?



10:43 pm on Sep 4, 2003 (gmt 0)

10+ Year Member

Hi Roy,

You could replace a character that occurs often (ie. the semicolon ';' which is usually at the end of a perl line ) with the same character and then a new line.

You'll need a text editor for this that can use 'regular expressions' in it's find/replace function(most I think, I use Textpad), possibly your html editor could do it as well (DreamWeaver can)

A new line in a regular expression is indicated by '\n' (without the quotes)

So when you replace

you would get something that looks a lot more readable. If not, just use a more suitable character then the semicolon. Remember to set the replace function to 'regular expression mode' or you would just put the literal \n in your code.

10:49 pm on Sep 4, 2003 (gmt 0)

10+ Year Member

I managed to find a solution - a module called PerlTidy