foreach my $val (keys ${\( STUFF() ) } ){ ... }

Here, keys is iterating over a hash reference. Quoth the docs (from 5.14):
    Starting with Perl 5.14, "keys" can take a scalar EXPR, which
    must contain a reference to an unblessed hash or array. The
    argument will be dereferenced automatically. This aspect of
    "keys" is considered highly experimental. The exact behaviour
    may change in a future version of Perl.
And indeed, this feature was tried, found wanting, and finally cast into Outer Darkness with Perl version 5.24. (And similarly for values, each, push, pop and, I think, some others.) See also Postfix Dereference Syntax and circumfix dereference syntax, discussed therein.

c:\@Work\Perl\monks>perl -wMstrict -le "print qq{perl version: $] \n}; ;; use constant { STUFF => { 'bizz' => 'foe', 'bazz' => 'fie', 'bozz' => 'fee', }, }; print ${\( STUFF() ) }; print STUFF; ;; foreach my $val (keys ${\( STUFF() ) } ){ my $subroutine = ${\( STUFF() ) }->{ $val }; print qq{A: '$val' -> '$subroutine'}; } ;; for my $k (keys %{ STUFF() }) { my $value = STUFF->{$k}; print qq{B: '$k' -> '$value'}; } " perl version: 5.014004 HASH(0x4340ac) HASH(0x4340ac) A: 'bozz' -> 'fee' A: 'bazz' -> 'fie' A: 'bizz' -> 'foe' B: 'bozz' -> 'fee' B: 'bazz' -> 'fie' B: 'bizz' -> 'foe'
(The circumfix dereference syntax is more widely supported — and I can't give an example of postfix dereference syntax anyway!)


Give a man a fish:  <%-{-{-{-<


In reply to Re^4: Calling a subroutine when part of call is a constant variable (symbolic method names) <2 updates> by AnomalousMonk
in thread Calling a subroutine when part of call is a variable Contant by Anonymous Monk

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.