Perltidy is really handy for cleaning up badly-formatted Perl code.

to install

cpanm Perl::Tidy

my .perltidyrc preferences

--cuddled-else
--paren-tightness=2
--vertical-tightness=1
--vertical-tightness-closing=2
--maximum-line-length=120
--no-outdent-long-quotes
--no-outdent-long-comments