in reply to Basic programming question
update: Whoops, just noticed that the OP is also decreasing $hour for the "PM" case. In that case, the ternary operator becomes a little more ugly.my $T = ($hour > 12) ? "PM" : "AM";
Your best bet is probably one of the CPAN modules like dragonchild recommends.my $T = ($hour > 12) ? do {$hour-=12; "PM"} : "AM";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Basic programming question
by tall_man (Parson) on Jan 27, 2005 at 16:44 UTC |