This is true in the general case, but I think it's completely the wrong advice in the present case. Why name something you don't care about? Specifically, $first and $ignore? Notwithstanding the fact that ignore is a really bad name. So is first, second and third but I assume you just named them that way for this example.

The slice syntax is much clearer: it indicates that whatever is in offsets 0 and beyond 2 are of no importance. And if the elements are not heterogeneous, there's no point in naming them separately as they are members of a group rather than individual elements in their own right. Thus, they have no need for names.

I find the code you posted less readable, as I have to spend time wondering what $first and $ignore are doing, and whether some code has been left off or accidentally removed that might have done something with them. And so I have to concentrate for a second and ask myself "what exactly is meant here...?!"

• another intruder with the mooring in the heart of the Perl


In reply to Re^2: split slice? by grinder
in thread split slice? by convenientstore

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.