[1,6,8..-1]

in this case "-" is seen as a metacharacter inside the character class and
is not seen as -1









Hi,
I have an unnamed array which I created from splitting up a colon separated
string:

      $_ = "0th:1st:2nd:3rd:4th:5th:6th:7th:Some random text: might have
:colons: or might not"
      print ((split /:/)[1,6,8]);

...but I really need to print everything after the 8th element.  If the
array were named, I could do something like this:

@arr = split(/:/);
print @arr[1,6,8..$#arr]);

... and this would include everything after the 8th array element.  I know
that -1 should start from the end of the array, but specifying [1,6,8..-1]
doesn't work.

I didn't see anything in perldata about it so I'm hoping someone has a
solution.

Thanks.
-- Brad




------------------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.

Reply via email to