in reply to GB, MB, KB and on..
how about something like this?
sub prettyBytes { my $size = $_[0]; foreach ('b','kb','mb','gb','tb','pb') { return sprintf("%.2f",$size)."$_" if $size < 1024; $size /= 1024; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: GB, MB, KB and on..
by Joost (Canon) on Jul 29, 2004 at 23:40 UTC | |
by cez (Novice) on Jul 29, 2004 at 23:48 UTC | |
Re^2: GB, MB, KB and on..
by glenn (Scribe) on Oct 21, 2013 at 13:12 UTC | |
by hdb (Monsignor) on Oct 21, 2013 at 14:31 UTC |
In Section
Seekers of Perl Wisdom