in reply to file size representation

A very full implementation might be:
sub best_size { my $r = shift; ($r > (1024 * 1024)) ? return sprintf("%1.3f", $r/(1024*1024)) . 'M +B' : ($r > 1024) ? return sprintf("%1.3f", $r/1024) . 'K +B' : return $r . 'B'; }

This will return a string with the "most appropriate" suffix. Modify to suit your purposes, such as different precisions, or changing to the next suffix before actually reaching 1KB, 1MB, etc.