How to Debug Perl Scripts

Writing Perl scripts can be helpful when compiling data and creating reports. It's a general-purpose programming language that was initially developed for use in Unix-based operating systems and development environments. While Perl scripting may be easy for the skilled, it's easy to make some simple mistakes. Before deploying a Perl script into a production environment, it's best to test the script for issues by performing different debugging commands.

Instructions

    • 1

      Launch your Perl script and type "-d" to enter the debugging mode. This will allow you to execute debugging commands.

    • 2

      Type "h" to print out a help message that will explain what your Perl script modifies.

    • 3

      Type "T" to run a stack trace on your Perl code and view a stack of the lines one by one.

    • 4

      Type "n" to execute the subroutine calls recursively until the start of the next Perl statement is reached in your script.

    • 5

      Type "S" to generate a list of all of the subroutines in your Perl script to ensure that all of the required subroutines are present.

    • 6

      Type "H-number" to generate a list that displays the list of all of the "n" commands that were executed in the most recent session. Note that only commands that are longer than one character will be displayed.

Tips & Warnings

  • Debugging commands in Perl are case sensitive, so please be sure that you are using the appropriate case when entering the different commands.

Related Searches:

References

Comments

Related Ads

Featured