sub b26_to_b10 { my @digits = reverse split //, shift; my $i = 1; my $result = 0; for ( @digits ) { $result += ( ord(lc($_)) - ord('a') + 1 ) * $i; $i *= 26; } return $result; }