When I run a Perl script, how can I debug it? For example, in ksh I add the -x
flag. But how I do the same in Perl?
I would also recommend using the Perl debugger.
However, since you asked about something like shell's -x
have a look at the Devel::Trace module which does something similar.
The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.
Brian Kernighan, "Unix for Beginners" (1979)
(And enhancing print statements with Data::Dumper)