in reply to Module for file size arithmetic

It's probably a sledge hammer to crack a nut, but take a look at Data::Dimensions, which could probably also handle sizes in sectors, tracks and the like, given the parameters for the disk geometry.

Replies are listed 'Best First'.
Re^2: Module for file size arithmetic
by mirod (Canon) on Mar 12, 2009 at 10:42 UTC

    My first test gets me a segmentation fault, so I'm not sure...

    perl -M'Data::Dimensions qw(:extended &units)' -E'say add( "1.2G", "50 +0M"); \ sub add \ { my $sum= units( { byte => 0 }); \ foreach (@_) { $sum += $_ } \ return $sum; \ }\ '