Lab1: The Perl Debugger
Assuming you have a Perl program in a file named prog.pl in the
current directory, type
perl -p prog.pl
to start the Perl debugger. Try the following commands:
- h - give a brief list of debugger commands (
man perldebug will
give more extensive help)
- v - view source code near current line
- v x - view source code near line x
- l x - print line x
- l x,y - print lines x through y
- l subname - print the definition of subroutine
subname
- p $x - print the value of variable x
- s - execute the next line of code, step into subroutines
- n - execute the next line of code, subroutine calls count as one line
- carriage return - s or n, whichever was most recent
- b x - set a breakpoint at line x
- b subname - set a breakpoint at subroutine
subname
- c - continue execution
- L - list all breakpoints
- B x - delete breakpoint at line x
- B * - delete all brakpoints
- q - quit back to the shell