2 comments. I use: $debug = 20; print "debug info here\n" if $debug > 5 print "even more info here\n" if $debug > 10 etc. which lets me turn on and off levels of debug during the process (e.g. subroutines can dump details or just announce their presence as they get 'better' throughout the scripting). I try to write these sorts of debug stmts at the beginning and leave them in (often for years ;-) as experience shows I'll need them later and often need to turn them back on or bump the levels back up as things change. The other thing I just saw was somebody wrote all there constant comparisons: if ( 6 == $value ) { ... claiming that this "catches" the missing "=" problem at compile time (can't do 6 = $value) w/o the -w. Not sure I believe its a good thing (ugly for one, reads wrong) and not sure '6' shouldn't be $value_if_this sort of constant somewhere (in most cases) but the fellow is very accomplished programmer so take it for what you will. a

In reply to Re: Easy, elemental, but cool debug trick. by Anonymous Monk
in thread Easy, elemental, but cool debug trick. by jjhorner

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.