in reply to
Looking for help for unit tests and code coverage on an existing perl script
I would extract a module from your script and unit test the module
directly via Test::More and the prove command.
I like to keep my script mainlines as short as is practicable,
with all the heavy lifting done in (unit-tested) module/s.
There are many examples of this general approach on the CPAN;
see, for example, the perltidy command,
part of the Perl-Tidy distribution
and the perlcritic command, part of the Perl-Critic distribution.
As an alternative, and perhaps a bit less work, you could
re-structure your script as a "modulino", that is, a script
that can masquerade as a module for ease of testing.
This approach is described at:
See also: How do you test end-user scripts?