You can program in COBOL(style wise) using java, but you probably shouldn't do so. Likewise making an array into an object seems more like an excercise of mimicing that other language rather than providing much real benefit.

Perl provides enough facilities for managing arrays that its not necessary to objectify them, other than to be a purist :-) At least I can't think of any methods that are lacking/missing. By facilities I mean -1 is the last element, scalar(@array) is the length/number of elements, $#array is the number of the last element. push/pop/unshift/shift - all for adding or removing from the front or the end. The common perl idiom is to use a HASH as your blessed object, and that hash may contain references to simpler types like an arrays. Not critcizing you for doing this..I've done fun things like this to see if I 'could' myself. I'm actually curious as to the reasons you want to objectify an array.

In reply to Re: Functions to Methods by blueAdept
in thread Functions to Methods by neniro

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.