Brent Dax wrote:
> Larry Wall:
> # There's also an issue of what (1..10) - 1 would or should
> # mean, if anything. Does it mean (1..9)? Does 1 + (1..10)
Actually, I would at first glance think, based on the parens, that:
(1..10)-1
means
((1-1)..(10-1))
means
(0..9)
.... and if someone has been playing a lot with the superposition stuff,
that is probably what they would indeed expect. That's also a valuable
interpretation, since it means you can say things like
(1..$n) * 10
And get a list (10,20,...) without having to change $n.
However, by the same logic,
@array * 10
means
@array [*] 10
which it doesn't. So maybe the correct interpretation of the above is
indeed this:
(1..10)-1 # (1..10).length-1, e.g. 9 (oops!)
(1..10) [-] 1 # (0..9) (correct, if that's WYM)
meaning that (1..10)-1 almost always does The Wrong Thing(!)
MikeL