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

Re^2: How can I encode a string using only lower case letters and numbers?

by tkguifan (Scribe)
on Feb 15, 2015 at 19:47 UTC ( [id://1116810]=note: print w/replies, xml ) Need Help??


in reply to Re: How can I encode a string using only lower case letters and numbers?
in thread How can I encode a string using only lower case letters and numbers?

I have just installed Math::Base36, but it only accepts numbers, not strings. How do I turn a string into a decimal number?
  • Comment on Re^2: How can I encode a string using only lower case letters and numbers?

Replies are listed 'Best First'.
Re^3: How can I encode a string using only lower case letters and numbers?
by BrowserUk (Patriarch) on Feb 15, 2015 at 21:43 UTC

    Will also deal with the full range of byte values, 0..255:

    $b36 = ''; $b36 .= encode_base36( $_, 7 ) for map unpack('V', $_), unpack '(Z4)*' +, 'ASillyLongstringWithFunnyCharacters!"£$%^&*():;@#~{[]}`¬¦|\/?';; print $b36;; 0U2W3EP0UVQCMK0WB704U0SP59PU0SZDAHJ0UN2HQE0R0Z2IH0WAKHV609A4RJ90AB0EG2 +0B56YQM0HTL7HL0PDSILF1B9UICD0D52TWD $s = ''; $s .= pack 'V', $_ for map decode_base36( $_ ), unpack '(a7)*', $b36;; print $s;; ASillyLongstringWithFunnyCharacters!"£$%^&*():;@#~{[]}`¬¦|\/

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-18 00:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found