Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Split int into segments of max int 26

by choroba (Bishop)
on Sep 13, 2017 at 11:44 UTC ( #1199293=note: print w/replies, xml ) Need Help??


in reply to Split int into segments of max int 26

Use Math::Base::Convert :
#! /usr/bin/perl use warnings; use strict; use feature qw{ say }; use Math::Base::Convert; my $converter = 'Math::Base::Convert'->new(10, ['A' .. 'Z']); say $converter->cnv(1000);

The strings will be a bit different to what you proposed, as A stands for 0 (thus it's A, B, C, ..., Z, BA, BB, BC, etc.), but it's not clear whether it matters.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Split int into segments of max int 26
by thanos1983 (Priest) on Sep 13, 2017 at 14:28 UTC

    Hello choroba,

    That is a nice approach, I had not idea about the module.

    Thanks for sharing.

    BR / Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199293]
help
Chatterbox?
and John Coltrane plays...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2017-11-25 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (355 votes). Check out past polls.

    Notices?