in reply to Using 'bind' or 'tie' to automatically swap variable values.

I think Tie::Cycle does what you want:

use Tie::Cycle; my @list = (("#cccccc") x 10, ("#xffffff")x10); tie my $cycle, 'Tie::Cycle', \@list;

Be aware though that your cycle can easily go out of step if you're using the variable elsewhere, but you're likely aware of that already.

Replies are listed 'Best First'.
Re^2: Using 'bind' or 'tie' to automatically swap variable values.
by polettix (Vicar) on Jun 12, 2006 at 09:21 UTC