#!/usr/bin/perl use strict; use warnings; use 5.012; # 905168 for ( my $count = 0; $count <=5; $count++ ) { say "There " . ($count == 1 ? " is " : " are " ) . " $count piece" + . ($count != 1 ? "s" : "" ) . " of pizza left."; } =prints There are 0 pieces of pizza left. There is 1 piece of pizza left. There are 2 pieces of pizza left. There are 3 pieces of pizza left. There are 4 pieces of pizza left. There are 5 pieces of pizza left. =cut
In reply to Re: one-line conditional print?
by ww
in thread one-line conditional print?
by MrSnrub
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |