> The arrow does not work on lists nor arrays (it imposes scalar context, so it operates on the last member or size, respectively):

Sadly yes, thats one advantage of autobox, were (IIRC¹) one needs to overload arrow to achieve this.

OTOH it's far faster then a normal method call, there is no inheritance chain look-up at run time.

Another important difference is that a method "pollutes" the variable namespace, i.e. variables called '$grep' could cause conflicts.

Also importing lexical variables from packages won't be easy ( while I can imagine an eval -hack in importer). So importing such methods could lead to package vars.

But "Pro" or "Con" depends on the perspective.

If the intention is to port an OO language like JS or Ruby and to reflect syntax and semantic this should be a cool approach, since most of those languages have no separate namesspaces (no sigils!)

Another use case is to have local ad-hoc wrapper methods for objects w/o manipulating corresponding classes.

Cheers Rolf

( addicted to the Perl Programming Language)

Update

¹) at least thats what I figured out the last time I looked into it, but my Perl foo was limited back then..


In reply to Re^2: Autoboxing ... "Yes We Can" ( or how I learned to love TIMTOWTDI ) by LanX
in thread Autoboxing ... "Yes We Can" ( or how I learned to love TIMTOWTDI ;) by LanX

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.