Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Output of mindfcuk
by dewey (Pilgrim) on Jun 09, 2007 at 17:59 UTC
    What exactly do you need help understanding? If you know what each line does, you just need to sit down with a piece of paper and start keeping track of what everything is (basically run the program yourself). If you don't know what a line does, there are some good resources online for learning perl, or you can look it up in perldoc. Does that help you get started?

    ~dewey

      Yes, I did that. I had worked on it before posting.

      I'm still not able to figure what is happening in the middle part, with so many "while" loops.

        I'm still not able to figure what is happening in the middle part, with so many "while" loops.

        You see, the Perl code is simple in that it uses a very limited subset of the language. And it is complex in that it uses lots of construct from that subset to do thing that in "proper" Perl would take a single statement. Thus you may look at it as an obfu demunging exercise, the point being here, that single steps are easily understandable. To grasp the overall picture is purely a matter of having the time and the will to follow them all. (Perhaps running in the debugger could help.) As an example consider the following excerpt, chosen randomly:

        while($m[$p]){ $p-=1; $m[$p]+=10; $p+=1; $m[$p]-=1; } $p-=1; $m[$p]+=3; $p+=1; $m[$p]=ord getc; print chr$m[$p];

        The first loop repeatedly modifies $p by respectively adding and subtracting one to it, so that in fact it just bounces between two values which are respectively its initial one, say $p, and $p-1. It repeatedly subtracts one to the former until it become zero and adds ten to the latter. Without using a loop that amounts to

        $m[$p-1] += 10 * $m[$p]; $m[$p] = 0;

        The second assignment is redundant though, because the value is not used later before it gets assigned something completely different. Then ord and chr are inverse functions, so except for the side effect of assigning to $m[$p], the last two statements just amount to

        print getc;

        And so on...

Re: Output of mindfcuk
by Anonymous Monk on Jun 10, 2007 at 04:47 UTC

    I had print statements scattered all of the code. What I understand is it prints "dQ5]q" from array 0 to 4. It collects the user input from array 5-9 (five characters). It then does a lot of "while" loops to erase the values of the array from 5 to 9, and then from 0 to 4.

    I don't seem to find any where in the code that could indicate to me what the inputted string is compared with or what the username is.

    Has anyone tried to run code? Could you shed some light?
A reply falls below the community's threshold of quality. You may see it by logging in.