# Collection of code snippets by Arne Vajhøj 
# (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
open(F, "num.txt");
$sum = 0;
$sum3 = 0;
while($line = <F>) {
    @parts = split(/\./,$line);
    $sum = $sum + ($parts[0]*100000 + substr($parts[1],0,5));
    $sum3 = $sum3 + substr($parts[1],5,5);
}
close(F);
$sum = $sum + ($sum3 - $sum3 % 100000) / 100000;
$sum3 = $sum3 % 100000;
$sum1 = ($sum - $sum % 100000) / 100000;
$sum2 = $sum % 100000;
$res = sprintf("%d.%05d%05d",$sum1,$sum2,$sum3);
print "Sum=$res\n";
