#!/usr/bin/env perl use strict; use warnings; use Math::BigFloat; use feature qw(say); my $x = Math::BigFloat->new(0); my @nr = ( '32431.19', '20', '-10', '-31800' ); foreach (@nr) { $x += $_; say qq($_\t=>\t$x); } __END__ karls-mac-mini:playground karl$ ./math.pl 32431.19 => 32431.19 20 => 32451.19 -10 => 32441.19 -31800 => 641.19