It is said that the best debugging aid is a set of liberally sprinkled print statements and some careful logical thought.
I find it useful to give most of my larger programs a 'verbose' mode which prints out progress indication, time spent, contents of data structures and whatnot. The easiest way of doing so is to have a sub:
sub debug_info {
print join ':', "\n*", @_;
print "\n";
return 1;
}
then throughout the program have lines like:
debug_info('plotting world domination',$foo, $bar) if $verbose;
I usually make a command line option for verbosity with something like:
my $verbose = $ARGV[0] || 0;