in reply to Re: Confused as to why the "casting context" is mis-behaving
in thread Confused as to why the "casting context" is mis-behaving
In my mind, the 'scalar' applies to the result of the slice, but obviously it 'reaches into' the subscripting square brackets to create a slice of the rightmost subscript.
That is what I wished happened. If I'd bothered to try to design what it should do rather than throw together the quickest patch possible, I would have made it do that (at least the me of today would have).
But, no, that isn't actually what happens. You can see that easily enough:
my @a= ('a'..'d'); my @b= (4,2,1); print scalar @a[0,@b], $/; print @a[scalar(0,@b)], $/; __END__ b # $a[1] because $b[-1] is 1 d # $a[3] because @b has 3 elements
- tye
|
|---|