in reply to perl option to trace execution
perl -d script.pl
Takes a little learning to use the debugger.
There's a graphical debugger addon that I've recently been using that's (in my opinion) very useful, and fairly stable. Its Devel::ptkdb and is invoked via perl -d:ptkdb script.pl.
More info here: http://search.cpan.org/~aepage/Devel-ptkdb-1.1091/ptkdb.pm