this is called a hash slice.
someone has declared o as a hash, and wants to set up 3 elements in semi-odd way.
it's equivalent to
%o= (a=>'a', b=>'b', c=>'c');
except that you can't declare a hash under strict this way -- you still need to explicity code my %o, and then use the hash slice.

So what's it good for?
Primarily when you're populating an array from a hash, and you only want to use a subset of the hash's values. It can be onerous to type @ary=($hash{e}, $hash{f}, ... $hash{n}), if you only wanted those particular elements, so the almight Wall-Oz gave us the hash slice, which reduces the assignment to @ary=@hash{"e".."n"} (yes, there are other ways of doing this, I acknowledge)
Here's a small example for you showing the hash slice in action :

use strict; my %o; @o{qw(a b c d e f)} = (1,2,3,4,5); my @foo; @foo=@o{"c".."e"}; print @foo;
the third line uses a hash slice to assign 5 values to %o. the fifth line uses a hash slice to easily take 3 elements from %0, and assign their values into @foo.
Also, even though I haven't demonstrated it, using
@o("a","e","f")
is just as legal.

See also array slices for a similar concept, but with arrays.

update : hey, neat! @foo=@bar{sort keys %bar};


In reply to How I learned to stop worrying and love the hash slice. (boo) by boo_radley
in thread beyond me by jroberts

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.