While I wish you the best of luck on this rather grand endeavour I'd highly recommend reading this node and it's multitudinous replies before going any further as it discusses in some depth the difficulties of implementing a beautifier for perl code.
HTH