Wednesday, February 08, 2006

Debugging in Perl

I usual use "perl -d your_scripts scripts_parameter" to debug my Perl scripts.

Some commonly used debug commands are:

* b [line number | function name]
create a breakpoint in a line or a function

* B [breakpoint number]
remove breakpoint

* l
list the content of the script

* L
list breakpoints

* n
step over subroutine

* s
single step

*
repeat the last n or s command

* p [variable name | statement ]
print the value of a variable or the result of a statement

* c
continue running till next breakpoint

* r
start to run

* q
quit the debugger