use Math::BigInt; $d = Math::BigInt->new(0); foreach my $h (split'','0x0081def509be'){ #UPDATE: Doh! Thinking base 10, this now # agrees with IO's result. It also # handles arbitrarily large hex values. # $d = Math::BigInt->new($d->bmul(10)); $d = Math::BigInt->new($d->bmul(16)); $d = Math::BigInt->new($d->badd(hex($h))); printf " :: %i : $d \n", hex($h); } print $d, "\n";