Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Being rather new to writing Perl, I'm still learning some new debugging tools, but I have carried one practice over from my other programming languages that has greatly helped - printing the contents of my data structures.

I tend to deal with rather compex data structures fairly often and it has lead me to become almost obsessed with seeing exactly what data I have stored in my structures - especially when I've found a bug. I've noticed that, all too often, fellow programmers simply assume that the data that's in their structures is correct and that their logic is wrong. They then spend countless hours trying to find the faulty logic only to find that their data was no good in the first place.

My debugging rule of thumb is to make sure that you know exactly what you're dealing with and then you can step through your code with a debugger or even by hand, if need be. Without knowing if your data is correct in the first place, there's no way of truly debugging your code. I think this is something that programmers (sometimes very good programmers) take for granted and fail to inspect.

Is that something that other people have noticed? I think that I might just feel this way because I deal with so many complex data structures.

- Sherlock

In reply to Re: Are debugging skills atrophying? by Sherlock
in thread Are debugging skills atrophying? by dws

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (5)
    As of 2018-02-18 07:46 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (251 votes). Check out past polls.