Can someone tell me where else this function chaining EXPR (chr hex) can be used in perl?

It's just a combination of function calls and map:

$ perl -MO=Deparse,-p -e 'map chr hex, @code_points' map(chr(hex($_)), @code_points);

The behavior of chr and hex can be achieved with the (_) prototype, though prototypes are one of those "only use this if you know what you are doing" kind of thing because they change how Perl code is actually parsed (see also).

Parentheses can be omitted in calls to subs which the compiler has already seen.

$ perl -wMstrict -le 'sub foo {} foo "bar"' # ok $ perl -wMstrict -le 'sub foo {} foo("bar")' # ok $ perl -wMstrict -le 'foo("bar"); sub foo {}' # ok $ perl -wMstrict -le 'foo "bar"; sub foo {}' # fails String found where operator expected at -e line 1, near "foo "bar"" (Do you need to predeclare foo?) syntax error at -e line 1, near "foo "bar"" Execution of -e aborted due to compilation errors.

The only thing special here is map and grep, which have as an alternative to their map {...} ... and grep {...} ... forms the map ..., ... and grep ..., ... forms. The former two can be emulated using prototypes (e.g. (&@)), while the latter two can't.


In reply to Re^2: Emoji Progress Spinners by haukex
in thread Emoji Progress Spinners by kcott

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.