HaloO

I wrote:
   my @a = 0,1,2,3,4,5,6,7,8,9;
   my $i = 5..*;
   say @a[$i];  # prints 5 6 7 8 9

And how about

    my $i = 5..*-1;
    say @a[$i]; # prints 5 6 7 8?

The rational would be that the -1 goes
into the range Whatever value, that is
when it comes to expanding it inside the
array index the following information is
available:

  1) the start of the range = 5
  2) the -1 of the Whatever
  3) the array's last index = 9

these result in the following array access

  say @a[5..9-1];

Instead of the array's last index the array length = 10
might be used and we end up with an access of @a[5..10-1].
But then how would $i = 5..* work? It would need to be
written $i = 5..^* to exclude the index 10.


Regards, TSa.
--

Reply via email to