|Perl: the Markov chain saw|
veRy Nic3 !
Here is my solution to this riddle ;)
The core of the job is done by the first map which will crypt the 6 words of the string "writing Library. Building consider TO($FOO) *binary*" (split on space) with the numbers at the begining of the list @:: ( obtained with shift ) .
This step can be rewrited as :
If you print @result you will see :
Now, in the same map liverpole pops the value at the end of @:: into $x , which is used into a regexp against the crypted values . This can be rewriten as :
If you print @final you get :
The match is fairly understandable : it could read as "any character", "any character", "remember those next $x any character", "anything till the end of line" . And as it happens, $x selects the characters we need from @result !
And the next map is giving the proper formating .
But there is one last thing that i didn't know here : in the first map, the value returned by the map function is what was matched in the regexp ! Now that's interesting !!