in reply to Interesting Use for "state" Variables

I'm no structure expert, nor state variable afficienado, but isn't this the sort of situation where you use a hash?
my %hash; my $count = 0; foreach my $key qw(red blue green yellow black white purple brown orange gray){ $hash{$key}{'index'} = $count; $hash{$key}{'state'} = 0; $count ++; }
Now do your manipulations on the hash, and set the values accordingly?

I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness