Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

A little golfing challenge: Replacing letters with numbers

by haukex (Bishop)
on Feb 21, 2019 at 08:48 UTC ( #1230284=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    A=>1,  B=>5,  C=>6,  D=>4,  E=>7,  F=>16, G=>10, H=>11,
    I=>12, K=>14, L=>13, M=>15, N=>3,  P=>17, Q=>8,  R=>2,
    S=>18, T=>19, V=>22, W=>20, Y=>21, Z=>9
    
  2. or download this
    NDDDDTSVCLGTRQCSWFAGCTNRTWNSSA 0
    VCLGTRQCSWFAGCTNRTWNSSAVPLIGLP 0
    ...
    FLCGNGVYKGFPPKWSGRCGLGYLVPSLTR 0
    KGFPPKWSGRCGLGYLVPSLTRYLTLNASQ 0
    QSVCMECQGHGERISPKDRCKSCNGRKIVR 1
    
  3. or download this
    3 4 4 4 4 19 18 22 6 13 10 19 2 8 6 18 20 16 1 10 6 19 3 2 19 20 3 18 
    +18 1
    22 6 13 10 19 2 8 6 18 20 16 1 10 6 19 3 2 19 20 3 18 18 1 22 17 13 12
    + 10 13 17
    ...
    16 13 6 10 3 10 22 21 14 10 16 17 17 14 20 18 10 2 6 10 13 10 21 13 22
    + 17 18 13 19 2
    14 10 16 17 17 14 20 18 10 2 6 10 13 10 21 13 22 17 18 13 19 2 21 13 1
    +9 13 3 1 18 8
    8 18 22 6 15 7 6 8 10 11 10 7 2 12 18 17 14 4 2 6 14 18 6 3 10 2 14 12
    + 22 2
    
  4. or download this
    $ perl '-M5;%h=map{$_,++$i}split//,"ARNDBCEQZGHILKMFPSTWYV"' -alpe '
      ($_=$F[0])=~s/[A-Z]/$h{$&} /g'
    $ perl -alpe '
      ($_=$F[0])=~s/[A-Z]/(index("ARNDBCEQZGHILKMFPSTWYV",$&)+1)." "/ge'
    
  5. or download this
    $ echo "ARNDBCEQZGHILKMFPSTWYV" | perl -MSet::IntSpan -ple '
      $_=Set::IntSpan->new([map{ord}split//,$_])->run_list;
      s/\d+/chr$&/eg;s/,//g;$_="[$_]"'
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2020-11-24 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?