| Public Scratchpad | Download, Select Code To D/L |
Note: Obviously perl golf is a game, in stark contrast to Best Practices.
there's not a lot to it...
It's a couple bits:
The first @_=qw; ... ; just assigns a list of words (quotelike) into @_. (it's trixy because it uses ; as the delimiter) @_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;
The second is a list slice (llama book), inside a regex replace. So, the stuff I just stuck into @_. slices take the form @...[ LIST ] (array slice) or @...{ LIST } (hash slice)
The LIST however, is map hex,split'',B204316D8C2A4516DE, being
so, we have the list slice @_[11,2,0,4,3,1,6,13,8,12,2,10,4,5,1,6,13,14] which just pulls the words out of @_ in a different order... twelth first, then the third, then the first (arrays start at 0 afterall) this gives you the list
('better','to','ask','and','appear','f00li5h', 'for','a','moment','than','to','pretend','and','remain', 'f00li5h','for','a','lifetime')
so, that list of words is interpolated into a regex that also uses ;'s as it's delimiters. This simply replaces the empty string with that list, and operates on $_ by default. It's the same as $_ = join ($", @_[ LIST ]), (when a list is interpolated into a string, it's elements are seperated with whatever's in $" from perlvar)
Then there's y/05/os/ which just replaces 0 with o and 5 with s (to de-1337 my nick). y/// is a shortcut for perlfunc's tr.
Finally, we have a &print, printdefaults to printing $_, which is where all the action has been thus far. The & is a bitwise and, which serves no real purpose, it could have easily been a ;.
Here it is, line broken at statements, with sensible delimiters
@_=qw[ ask f00li5h to appear and remain for a moment of pretend better + than a lifetime] ; s{}{@_[map hex,split'',B204316D8C2A4516DE]}; y/05/os/ & print;
Hrm, there turned out to be more to it than I thought!