IMO Tie::Cycle has two disadvantages: It always rotates the list by only one position (hence is not better than the push(...,pop...) variant), and it rearranges the list every time I access the tie'd variable. No surprise: Tie::Cycle was made for a completely different purpose than I'm going to use it: I want to rotate the array only once, but then by a certain number of positions.
However, the solution using splice, which moritz proposed, looks better than those I came up with. I thiink I will use it.
In reply to Re^2: Rotating an array
by rovf
in thread Rotating an array
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |