One of several ways:
printf "There %s $_ piece%s of pizza left\n", $_==1 ? ('is','') : ('are','s') for 0 .. 2;; There are 0 pieces of pizza left There is 1 piece of pizza left There are 2 pieces of pizza left
In reply to Re: one-line conditional print?
by BrowserUk
in thread one-line conditional print?
by MrSnrub
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |