Beyond the general trigger debugging suggestions given in Debugging Triggers, here are a few Perl-specific methods to make debugging Perl scripts easier. These very general methods are applicable whether you are using Perl to script triggers, or for other scripting applications such as daemons or command-line tools and scripts:
Including this pragma at the head of all your scripts will enforce 'strict' use of subroutines, references and variable names. The practical use of this pragma is that it turns many run-time errors, which might be difficult to correctly detect and diagnose, into compile-time errors, making them easier to detect and correct.
For more information on this pragma, see the "strict" page at perldoc.org
Even if your script is syntactically correct, you might not get the results you expect, particularly if you are not sure what type of data a command returns. The
Data::Dumper module will take a reference to a data structure (an array, hash or more complex data type) and print them out in Perl syntax, following internal references.
Data::Dumper module is part of the Windows ActiveState distribution, or is available from CPAN Data-Dumper page.