in reply to Re^2: Code challenge: array subrange
in thread Code challenge: array subrange

Actually, $[ = $r->[0]; will work, but it required more work than I cared to do.
sub ranger { my @arr = @{$_[0]}; my ($r1, $r2) = @{$_[1]}; my ($sr1, $sr2) = @{$_[2]}; my @v = eval <<__END_EVAL__; \$[ = $r1; ($sr1 < $sr2) ? \@arr[ $sr1 .. $sr2 ] : reverse \@arr[ $sr2 .. $sr1 ]; __END_EVAL__ return @v; }

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.