Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Alpha base-26 to base-10...

by sauoq (Abbot)
on Jul 01, 2003 at 00:15 UTC ( #270368=note: print w/ replies, xml ) Need Help??


in reply to Alpha base-26 to base-10...

I'd prefer something more readable than concise. It's a concise enough problem anyway.

sub b26_to_b10 { my $base_10 = 0; for (split //, lc shift) { $base_10 *= 26; $base_10 += ord() - 96; } return $base_10; }
-sauoq
"My two cents aren't worth a dime.";


Comment on Re: Alpha base-26 to base-10...
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://270368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-10-02 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (49 votes), past polls