Am I an idiot, or what? I'm trying to dump a simple hash. I thought it would be easy, just call some nice routine that will output all the key/value pairs in the hash. So, I pick up my handy _Perl in a Nutshell_ book (quite nice actually) and they have a description of Data::Dumper. I look at "simple procedural interface" and enter:
%hash = {this => "one", that => two}; print Dumper (%hash);
Which gives a nice thing indicating that the argument is a hash (duh!).

I'm basically a "printf" kind of debugger. It works quite well, and I've used this in Perl. This SHOULD be a simple task without TOO much trouble. Someone must know a SIMPLE solution that will print out the key/value pairs kinda like:

this => "one", that => "two"

Of course I could write a routine (a bother!) that will iterate thru the keys, and print the values, but HASN'T someone done this already, or haven't I looked at the right place. Argggggg!!

The next lesson will be writing a "hello world" program :-)


In reply to dumping a hash by herby1620

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.