You can actually pass the hash of arrays by value without any problem, as if it were a single-dimension hash (in a sense it is a simple hash in which the values happen to be array refs):
$ perl -MData::Dumper -e ' my %h = (tim => [ 4, 7], joan => [5, 8], fr +ed => [8, 3]); > proc(%h); > sub proc { > my %h_sub = @_; > print Dumper \%h_sub; > }' $VAR1 = { 'tim' => [ 4, 7 ], 'joan' => [ 5, 8 ], 'fred' => [ 8, 3 ] };
Now, of course, this implies copying the (top level) hash. If it is large, you might want to use passing by ref to avoid the overhead of making such a copy. But the structure of the data does not prevent you from passing the hash by value.

In reply to Re: passing multi dimensional hashes into a sub by Laurent_R
in thread passing multi dimensional hashes into a sub by perlynewby

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.