Repeated division? How come? Here's a simple routine that
translates hex numbers into decimal ones. Replace the
my $answer = 0; with my $answer = Math::BigInt -> new (0);
to extend it bigger numbers.
my $c = 0;
my %X = map {$_ => $c ++} 0 .. 9, 'A' .. 'F';
sub hex2dec {
local $_ = shift;
my $answer = 0;
($answer <<= 4) += $X {substr $_ => 0, 1, ""} while length;
$answer;
}