For a solution perhaps more sophisticated that the classic negate-$x-each-iteration perhaps it would be illuminating to look at Easy binary toggle at fixed intervals, or perhaps Flipper, and of course, merlyn has probably written an article about this :)
IMHO the simplest is:
d:\>perl -e "print +($a += 1) %= 2 for 1..10" 1010101010
In reply to Re: negative toggle function
by EdwardG
in thread random negative toggle function
by zentara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |