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.
| [reply] [d/l] |
: ) this is my pm leader :) !!!
Very nice explanation.
| [reply] |
Please forgive my ignorance, whats a pm leader? :)
| [reply] |
Hey thanks kaif, monsieur :)
u guys rock, perl rocks, perlmonks rocks the hardest!
| [reply] |
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...
| [reply] |
| [reply] |
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.
| [reply] [d/l] [select] |