in reply to rounding off all members of a hash
That way is fine. I might have mapped instead:
That eliminates some temporary lexical variables which aren't really needed. (They could be eliminated in the explicit loop, too.)my %rounded_stats = map { $_ => sprintf '%.2f', $stats{$_} } keys %stats;
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: rounding off all members of a hash
by qef (Initiate) on May 04, 2005 at 08:09 UTC | |
|
Re^2: rounding off all members of a hash
by vindaloo (Acolyte) on May 04, 2005 at 04:02 UTC |