Think about Loose Coupling | |
PerlMonks |
Re: yet another email sigby higle (Chaplain) |
on Sep 27, 2001 at 20:48 UTC ( [id://115154]=note: print w/replies, xml ) | Need Help?? |
Very nice! And very original! So simple, and yet, so confusing! Let's see if I can dissect it a bit: The first line declares $a as a variable, and assigns it a string, using the q operator with "-" as a delimiter. The following string: is what is used as the pool of letters to write the program's output, "just another Perl hacker". Then you've got the closing "-" delimiter, followed by the ";" closing out that statement. The next bit is the fun part: $b is initialized with the value 59, and the while statement executes a regex search on the string 64aa22632f626f63913d8f3199583a6571c82d227fe107420 which basically grabs every two characters in that string, and stores them to the special variable $1. Inside the for loop, the value of $b is augmented using the following logic:
The next bit is interesting. The split operator is called on the big string contained in $a, splitting it by '', thus creating a big array composed of each individual character in the string, including spaces. [$b] is appended after the parenthesized split statement, thus turning the current value of $b into an array index, plucking the letter in that position out of the temporary array created by the split statement, and sending it to the print statement. Perhaps I over analyzed this one, but I had fun taking it apart and looking at it's components! ++iamcal! higle
In Section
Obfuscated Code
|
|