One common usage of the
Dumper function from the core
Data::Dumper module is to quickly display the contents of hash variables for debugging purposes, as your code seems to indicate. For example, if your
%usage is a simple hash, it is much simpler to view its contents using:
print Dumper(\%usage);
than to use a loop:
for (keys %usage) { print "$_ = $usage{$_}\n" }
The real power is if you have a more complicated data structure, such as a hash-of-arrays, a hash-of-hashes, or any arbitrarily deep structure (see perldsc). You don't need to know what the structure is: Dumper figures it out for you. There is no need for nesting loops just to print out the contents.
This is just one usage of the module (the one that your code uses). There are many more purposes and features which you can read about in Data::Dumper.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.