@saw{ @arr } = (); # The line I'm not understanding

Others said that this is a hash slice. Yeah, but how, and why?

It's context again. Consider:

{}; # hash reference []; # array reference %hash; # named hash $hash{'foo'} = 'bar'; # left-hand-side (LHS) of '=' in scala +r context @ary = (1,2,3); # LHS & RHS are in list context: # assign a list to an array named ' +ary' $hash{'foo'} = @ary; # LHS context(scalar) forces RHS scala +r context: # $hash{'foo'} == 3 , i.e. scalar(@ +ary) @hash{qw(foo bar quux)} = @ary; # LHS in list context, RHS in list con +text: # $hash{'bar'} == 2; $hash{'quux'} +== 3

The prefixes ($,%,@,&) for identifiers enforce context. So, @hash{@ary} = @list uses the %hash in list context, for which use the (imho) hard to grasp idiom 'slice', for naming the whole LHS expression, has settled.

--shmem

update: replaced "an array slice" with "a hash slice". Of course I meant "hash slice", as per ikegami's comment below. Glitches the like often happen to me, whilst thinking ahead. But best was a friend who reported she once thought "seven", said "1" and wrote "4", all at the same time..

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: De-Duping An Array by shmem
in thread De-Duping An Array by SheridanCat

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.