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
In reply to Re: rounding off all members of a hash
by Zaxo
in thread rounding off all members of a hash
by vindaloo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |