The trouble now is that the output is triple spaced. You can improve it to double spaced by removing the new line from the print. At the end of the day however Autoformat is not doing a good job for you. Nice idea, but no banana.
I suspect in general that competitions don't expect you to have access to a full range of CPAN modules and that there is generally a reasonable way of solving the problem without resorting to a module such as Text::Autoformat.
The single print version can be done without much modification of your current code and not using Text::Autoformat.
DWIM is Perl's answer to Gödel