Debugging with the built-in command line debugger, with Devel::ptkdb, or with print statements.

See the full article about debugging Perl scripts

An alternative screencast where you can actually see a live debugging session.

Devel::hdb is another debugger you could give a try.