in reply to Toggling between two values

Use the ?: operator instead of the list:

perl -e "$_=shift();print($x++ % 2 ? 'you are glad ' : 'I am glad ')wh +ile($_--)" 4 or perl -e "print($x++ % 2 ? 'you are glad ' : 'I am glad ') foreach(1..s +hift())" 4

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature