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
In reply to Re: Toggling between two values
by Jenda
in thread Toggling between two values
by pernod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |