in reply to Re^2: Printing based on values?
in thread Printing based on values?
use warnings; use strict; my %age = ( years => 28, months => 0, weeks => 0, days => 3, ); print 'You are '; for (qw(years months weeks days)) { print "$age{$_} $_ " if $age{$_}; } print "old.\n"; __END__ You are 28 years 3 days old.
But, an array may be simpler.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Printing based on values?
by Douglas0028 (Novice) on Mar 27, 2011 at 00:16 UTC | |
by toolic (Bishop) on Mar 27, 2011 at 00:24 UTC |