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 ...
Get Sams Teach Yourself Perl in 21 Days, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.