Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Einstein was a wise man

by Jouke (Curate)
on Mar 07, 2001 at 20:59 UTC ( #62783=obfuscated: print w/replies, xml ) Need Help??

@q=([6,13,0],[1,5,1,10,11,0,7,14,6,15],[0,7,8,0],[12,8,6],[9, 1],[12,13,3,6,0,1,2],[12,13,3,6,0,4],[8,6,2]);@w=(0,1,2,3,4,5 ,6,7,0,1,2,6,3,4,5);foreach$a(@q){foreach(@$a){@_=split(//, 'tedusvnhabrycoig');$x.=@_[$_]}push@y,$x;$x=''}print '"';foreach (@w){print"$y[$_] "}print"\"\n";


Jouke Visser, Perl 'Adept'

Replies are listed 'Best First'.
Re: Einstein was a wise man
by dze27 (Pilgrim) on Mar 08, 2001 at 02:34 UTC

    Well, this is the first time I've figured out obfuscated code (so maybe it's not that obfuscated?!).

    Spoiler follows: @q sets up anonymous arrays containing numbers which each represent a different letter. @w is an array for which each number represents a different word (there are lots of duplicate words in the phrase). Then the foreach loops iterate over each word, and then each letter is decoded by splitting a text string into an array. For instance, the first (0-indexed) item in the text string, t, corresponds to 0 in the @q array. A string is then built up for each word and then each word is added to an array with "push". Finally the result is output.

Re: Einstein was a wise man
by grinder (Bishop) on Mar 08, 2001 at 13:55 UTC
    Tsk, tsk Tsk. Jouke, Jouke, you didn't use the -w switch!
    @q=([6,13,0],[1,5,1,10,11,0,7,14,6,15],[0,7,8,0],[12,8,6],[9, 1],[12,13,3,6,0,1,2],[12,13,3,6,0,4],[8,6,2]);@w=(0,1,2,3,4,5 ,6,7,0,1,2,6,3,4,5);foreach$a(@q){foreach(@$a){@_=split(//, 'tedusvnhabrycoig');$x.=$_[$_]}push@y,$x;$x=''}print '"';foreach (@w){print"$y[$_] "}print"\"\n";
      I must most humbly admit you are right
      damn...stupid mistake

      Jouke Visser, Perl 'Adept'
Re: Einstein was a wise man
by gregor42 (Parson) on Mar 14, 2001 at 23:08 UTC
    Also, a brief note, you could save a whole 8 bytes of code by using 'for' instead of 'foreach'.
    Since 'foreach' simply aliases 'for'.
    But I suppose I'm just picking nits.

    Updated 20010523.1513: Golf anyone?


    Wait! This isn't a parachute, it's a backpack!!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2021-12-03 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (28 votes). Check out past polls.

    Notices?