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

Starting and Running the Debugger

Perl's built-in debugger is run from the command line using the -d option. If you've been running your Perl scripts on Unix or Windows NT using just the name of the script, you'll need to call Perl explicitly, with the name of the script and any filename arguments after that. In other words, if you usually call a script like this:

% myscript.pl names.txt
					

Call it like this for the debugger:

% perl
						-d myscript.pl names.txt
					

Alternately, if you think you'll be using the debugger a lot for a particularly gnarly script, you can add the -d option to the shebang line in the script itself:

#!/usr/ bin/perl –wd

Note

Don't forget to remove it again when you're done debugging.

To turn on the debugger in MacPerl, choose ...

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