- or download this
use Tie::Toggle;
...
my @color = qw(black white);
print "$color[$toggle]\n" for 1..10;
- or download this
use Tie::Cycle;
tie my $color, 'Tie::Cycle', [qw(red white blue)];
print "$color\n" for 1..10;
- or download this
use Tie::Cycle;
use Color::Spectrum qw(generate);
tie my $color, 'Tie::Cycle', [generate(4,'#ff00ff','#00ff00')];
print "$color\n" for 1..10;