When the data structures are a little complex (at least for the (not necessarily) intended audience ;--) I pepper the code with calls to Data::Dumper (actually with Data::Denter) that can be activated in debug mode, whether it is by setting a variable, an environment variable or just by uncommenting the print Dumper $HoHoA; statement. This way figuring out what's in the variable is not too hard for the maintainer. I don't usually use them myself actually, I prefer the wonderful x $HoH in the debugger, which works wonders, especially as you can then try print $HoH{foo}->{bar}; and see what comes out.
In any case not knowing how to deal with a HoH shows quite a limited grasp of the language (and of programing in general as a matter of fact). It might be worth mentioning to your co-worker that knowing how to deal with complex data structures is really required if he wants to be called a programer (you could maybe be a little more diplomatic than that though ;--).
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|