2017/01/02

Perl script to convert to x Based String


#/usr/bin/perl

use strict;
use warnings;
use constant DIV => 24;


my $v = shift or die "Usage: $0 ";

my $d = 0;
my $str = '';

do {
    my $c = chr(ord('A') + ($v % DIV));
    $str = $c . $str;
    $v = int($v / DIV)
} while ($v > 0);

print $str;

0;
发表评论