This a quick demonstration of what is going on under the Perl debugger:
DB<1> @c = ('jan', 1, 'feb', 2, 'mar', 3); DB<2> x \@c 0 ARRAY(0x80359de8) 0 'jan' 1 1 2 'feb' 3 2 4 'mar' 5 3
So, @c is an array.
DB<3> %d = @c; DB<4> x \%d 0 HASH(0x8042f6d8) 'feb' => 2 'jan' => 1 'mar' => 3
Copying @c into %d sorts of promote the data structure into a hash (provided the number of elements is even). This is what happens in your code snippet. The @_ array contains just a flattened list. $header take the first element of @_, and the rest of @_ is copied into the %types hash.

In reply to Re: Passing a scalar and hash as subroutine arguments by Laurent_R
in thread Passing a scalar and hash as subroutine arguments by jktstance

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.