http://www.perlmonks.org?node_id=281754

I don't know that this is terribly obfuscated, but at least you have to look at it twice to figure out what it's doing. It's my first JAPH, and my first attempt at obfuscation, so take that into consideration when evaluating its level of cleverness and obscurity. Someone reply when they figure out what and how. ;) And if you can improve upon it, I'd love to hear that too. This is a learning experience for me.

Based on a few suggestions I've further improved the code. Here it is in its present incarnation.

@qw{qw$.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --.. .-.-.- | !$}=(A..Z ,q$.$,$",$/);print$qw{$_}for split/\s/,".--- ..- ... - | .- -. --- - .... . .-. | .--. . .-. .-.. | .... .- -.-. -.- . .-. .-.-.- !"

If you plan on cutting and pasting it, pay attention to whitespace in the word-wraps. All whitespace is significant.

By now everyone knows that this translates morse to alpha. Someone suggested only defining morse for those characters that I use, but in my opinion, that detracts from the code by, first, crippling the morse decoder; this one is full-fledged with respect to alpha; and second, depending on how far I go toward only defining translations for characters that I use, I would have to do away with the "A..Z" slice, which would lengthen the code and de-obfuscate it.

Someone else suggested constructing morse based on an algorithm, but to my knowledge, there is no predictable pattern to the morse alphabet. Numbers are somewhat more predictable.

Finally, thank-you to those who offered tips toward reaching this most recent version. It's been a fun learning experience. Hopefully it provokes thought in others reading this thread. If you see other areas for improvement, I'd love to hear; the process never ends.


"If I had my life to do over again, I'd be a plumber." -- Albert Einstine