Jonathan Scott Duff wrote:
Surely you mean [EMAIL PROTECTED] instead of 0..InfI think the iterator implicit in array slicing should, and could, be smart enough to return when there's nothing more to iterate. Considering the following code:
@foo = (1, 2, 3); @bar = @foo[1..Inf];
@bar should contain (2, 3). the iterator could just throw an X::ENOITEM (or some such) exception after the "3", which (unless catched and rethrowed by a CATCH block, perhaps) will just terminate the iteration.
furthermore, something like:
@bar[1..Inf] = @foo;
should not (DWIMmy) take forever, but just assign (1, 2, 3) to the second, third and fourth element in @bar. on the other hand, this contrasts with the following code:
($x, $y, $z) = (1, 2);
which (in Perl5 at least) assigns undef to $z. for orthogonality's sake, the @bar[1..Inf] assignment should then produce an infinite lists of undefs, which doesn't look too practical. so maybe Inf should have a special meaning in array splicing anyway.
cheers, Aldo