I also played around with negative indicies, but the problem is that say with [-3..-1], in general we don't know what this -3 value is supposed to be because it is counted backwards from the right. All we know is that we don't want [0,1,2](counted from the left).

This >perl -E"@a = qw( a b c d e f ); say for @a[4..-1]" would work except for that pesky LHS > RHS returns empty list rule! My friend may be thinking that there is some new syntax like: @a[4..eol], where "eol" is some stand-in for the largest positive index whatever that happens to be. Or alternately some way to determine, not the value at [-1], but the positive index that it would correspond to.

I also wondered if there was some sort of new syntax that would express the idea of "give me everything except the stuff at these particular indicies...", but was unable to find anything like that.


In reply to Re^2: Getting range from N..end with list slice by Marshall
in thread Getting range from N..end with list slice by Marshall

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.