in reply to File Size Conversion

If you want nice printed output rounded then the printf "%.0f" deal is a very tidy way to go.

If you are trying to figure allocation blocks, you need to always round up and use the allocation size of where you are going.

For example, I did a program to split up multiple files to put on floppies and so that looked something like.

my $size=-s _; my $blocks=int($size/512)+1;

Floppy blocks were 512 bytes and there were 2880 of them on a disk less the formatting.

Also could add a check for a file exactly a multiple of 512 for which this code will reserve an extra block.