Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Please explain this JAPH

by Anonymous Monk
on Jun 10, 2005 at 03:00 UTC ( #465397=obfuscated: print w/replies, xml ) Need Help??

Please. Explain.
($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print
Thanks :)

2005-08-29 Retitled by Arunbear, as per Monastery guidelines
Original title: 'JAPH'

Replies are listed 'Best First'.
Re: Please explain this JAPH
by monsieur_champs (Curate) on Jun 10, 2005 at 11:56 UTC

    This is just a demi-hidden translation (y///) operation, using a '~' as separator. It gets the string on $_ and do $_ =~ y/b-v/a-z/s; print; on it.

    Simple and beautiful.

      : ) this is my pm leader :) !!! Very nice explanation.
        Please forgive my ignorance, whats a pm leader? :)
      Hey thanks kaif, monsieur :) u guys rock, perl rocks, perlmonks rocks the hardest!
      Its pretty clear now, and I guess it was a simple JAPH that I should have been able to decrypt, except for the "y" instead of the "tr" function. Is this documented somewhere (Camel book etc)?

      Thanks again...
Re: Please explain this JAPH
by kaif (Friar) on Jun 10, 2005 at 04:22 UTC

    Sure. But if you'd like a hint first, think of shift ciphers.

    The first part, $_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss' clearly sets $_ to that long string. Then comes the one tricky part. The transliteration operator comes into play, applied to $_ because of the =~ operator. Because Perl is nice, it lets you use any non-alphanumeric, non-whitespace character as delimiters. In this case, the ~ are delimiters; rewriting using /s, this would be y/b-v/a-z/s. Now, the y/// maps the character range b-v to a-z (although a-u suffices) first, which has the effect of changing the string to 'jjuussttaannootthheerrppeerrllhhaacckkeerr'. Finally, the transliteration operator has an option, /s which "squashes" duplicate characters. So we are done.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2022-05-25 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?