Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: convert letters into a number

by Prof Vince (Friar)
on Aug 30, 2007 at 13:46 UTC ( #636077=note: print w/ replies, xml ) Need Help??


in reply to convert letters into a number

Somehow shorter :

use List::Util qw/sum/; my %h; @h{'A' .. 'Z', 0 .. 9} = (1 .. 26, 0 .. 9); my $num = sum @h{map uc, split //, $letters};


Comment on Re: convert letters into a number
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2015-08-03 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (27 votes), past polls