Perl has a wonderful source-level debugger, which the perldebug documentation will tell you all about.