Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub unitFormat {
- my @unit = ("B","KB","MB","GB","TB","PB");
- my $index = 0;
- my($value) = pop;
- while($value > 1024) {
- $value /= 1024;
- $index++;
- }
- $value = sprintf("%.3f",$value);
- return "$value $unit[$index]";
- }
Add Comment
Please, Sign In to add comment