perldebug. However you may find it easier to add code in the form:

my $DEBUG = 0; # set to > 0 for debugging, the bigger the value the +more verbose # in the code wherever you think it useful $DEBUG && DEBUG( 2, "some message" ); sub DEBUG { my ( $debug_level, $message ) = @_; # see if we want this message a current debug level return if $debug_level > $DEBUG; # we can get info on where this info comes from from caller() my ( $package, $file, $line ) = caller(); # print a standard format message, say line num and message warn "$line\t\$message\n"; }

This is one of many ways to incorporate debugging. Just call the DEBUG function with an int first argument and a message. Set the debug level and get more verbose output. The $DEBUG && DEBUG( ... ) suntax is to avoid the sub call if we are not debugging.

cheers

tachyon


In reply to Re: How to track variable usage in a script? by tachyon
in thread How to track variable usage in a script? by Scarborough

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.