O'Reilly logo

Sams Teach Yourself Perl in 21 Days, Second Edition by Rafe Colburn, Laura Lemay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Debugger: A Simple Example

Probably the best way to see how Perl's debugger works is to show you an example of a typical use of the debugger. For this example, we'll step through the execution of a simple script that contains subroutines—the names script from Day 6, which reads in a list of names, prompts you for something to search for, and returns the names that match that search key.

When you run a script with the Perl debugger turned on, you'll end up inside the debugger itself, which looks something like this:

% perl
						-d  statssubbed.pl statsdata.txt

Loading DB routines from perl5db.pl version 1.01
Emacs support available.

Enter h or `h h' for help.

main::(statssubbed.pl:3):       &initvars();
  DB<1>

Note

Don't worry about starting the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required