aboutsummaryrefslogtreecommitdiff
path: root/challenge-002/simon-proctor/perl5/to-base-35.pl
blob: 4bee1b597d1cb01205234fcf27f103c09802bd39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use v5.10;

my $in = shift @ARGV;
my @out = ();

my $c = 0;
my %map = map { $c++ => $_ } (0..9,"A".."Y");

while ( $in ) {
    my $rem = $in % 35;
    push @out, $map{$rem};
    $in = $in - $rem;
    $in = $in / 35;
}

say join( "", reverse @out );