$b=$b*36-48-7*/\D/+ord for pop=~/./g; print$b,$/ #### sub x{ $_&&-7*/\D$/+ord(chop)-48+36*&x } $_=pop; print x,$/