Ruud H.G. van Tol skribis 2005-11-23 19:03 (+0100): > > Doesn't ^5 encourage [EMAIL PROTECTED] too much? > Can you explain when that creates a problem?
It's not about problems in execution, it's about expression. [EMAIL PROTECTED] returns the *number of elements*, not the index of the last element plus one. It should not be used for index math. There are cases where we should write @foo.last + 1, even though the result will in almost all cases be the same as [EMAIL PROTECTED], and there are cases where we should write @foo - 1, even though the result will be the same as that of @foo.last. That almost all arrays range from 0..i is no reason to write bad code. > Maybe someone doing > for ([EMAIL PROTECTED])->$i { say @foo[$i] } That should be ^(@foo.last + 1), or not using ^ at all. I'd prefer the latter. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html