Regarding your first question, yes, that was a typo (now fixed).

A hash slice is a way to access several values of a hash using a list of keys. For regular hashes, for example,

@hash{ qw( foo bar baz ) } = ( 1, 2, 3 );
has the same effect as
$hash{ foo } = 1; $hash{ bar } = 2; $hash{ baz } = 3;
You can use slices to copy several values from one hash to another. E.g.
@keys = qw( foo bar baz ); @copy{ @keys } = @orig{ @keys };
The last line copies three key-value pairs from %orig to %copy. In the code I posted earlier, the only difference is that the accessing of the RHS slice is done via a reference ($d) to a hash instead of a regular hash:
@h{ @flds } = @{ $d }{ @flds }; # hash slice assignment
Once you dereference a hash ref you can use it like any other hash.

Slices are discussed in perldata, and using references in perlreftut and perlref.

the lowliest monk


In reply to Re^3: Bloated code of loops and conditionals by tlm
in thread Bloated code of loops and conditionals by bradcathey

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.