There's no real question in your post, so I'll just comment on it :-)

I don't see any real problems with it (other than the fact that I prefer to group function definitions and not mix them with the rest of the code). The my (%HASH) has the effect of localizing the %HASH variable to the block where the doStuff function is declared, effectively making it invisible to everyone else and accessible only through that function. In this sense it is a good thing to have the my statement. If you remove it, the %HASH variable will be accessible from other parts in the program, which may or may not be what you want.

You mention %thisDataset a couple of times, but there is no such variable in your program. You have %HASH, and you have $thisDataset, which is a pointer to %HASH.

The use of %{$_[0]} in the second function looks good to me, but the @{$_{$KEY}} does not. I think it should be @{$_[0]->{$KEY}}. It may make things clearer to assign $_[0] to another variable, like this:

sub someThingElse { my $data=shift; # then you can use %{$data} and @{$data->{$KEY}} }

--ZZamboni


In reply to Re: Wanted further clarification on Data Usage by ZZamboni
in thread Wanted further clarification on Data Usage by Buckaroo Buddha

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.