in reply to Cleaning Whitespace from Source Code
perltidy -dws yourscript.pl [download]
See "perltidy -h" or "man perltidy" for more usefull options
kind regards