First you have to understand that you're slicing a list not an array.
Then a range from $index .. -1 must be empty because the upper bound must be bigger than the lower one (the range operator has no idea that you mean the biggest index, it's just the number "minus 1")
When using arrays you can write something like @array[$index..$#array] but as already stated you're not slicing an array and there is nothing like a counter for "last list entry". (your $# is another beast)
In short, you can't slice a list till the end w/o much obfuscatory magic, so better do it the "normal" way with arrays:
my @array = split /\n/, $object->get_array;
my @slice = @array[$index .. $#array];
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||