# will need adjustment if you want to do negative values # kbstring(1024) => 1KB # MS uses a threshold of 0.98. I find this to be a perfectly # acceptable threshold. 0.98*1024 == 1003. sub kbstring { my $value = shift; my @prefix = ('', qw(K M G T)); while (@prefix>1 && $value >= 1000) { shift @prefix; $value /= 1024; } return sprintf '%.2fdsB', $value, $prefix[0]; } #### $"=$,,$_=q>|\p4<6 8p .q>.<4-KI;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/