I used to use debuggers quite a bit. However, I found myself writing code without thinking it through, on the theory that whatever I wrote I could clean up using the debugger. This didn't work very well.

Now I use print almost exclusively. The trick is to stop what you're doing and think about what's happening (or not happening). Consider what must happen for things to work out as they do, and then test your idea with a well-placed print statement. Often I use a log file in order to have something I can look at carefully.

I think the decision about whether to use the debugger should not be made on the basis that the debugger is too hard. IMNSHO, one should learn it, and then see how it compares to print statements. Otherwise you may be overlooking a valuable tool. Much depends on personal preferences, and one size does not fit all.


In reply to Re: debugging - straw poll ... by spiritway
in thread debugging - straw poll ... by danmcb

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.