blob: 683acda914e4f49e2ca617e533e1763e5b214d8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
# bin/to-base35
sub to_int($_) { my @i = split(/"."/, $_[0]); @i[0] };
my @ARGV = do { sub eval { chomp &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) };
my ($result, $dict, $base10) = ("", {}, @ARGV[0]);
$dict{$_} = $_ for "1".."9";
$dict{ord($_) - 55} = $_ for "A".."Y";
while ($base10 > 0) {
$result = join("", $dict{to_int($base10 % 35)}, $result);
$base10 = to_int($base10 / 35);
}
print("$result\n");
|