I wonder if an explanation could be provided for those of us who watch in awe...
Awe? You should look in the Obfuscation section some
time and see truly obfuscated code. But basically this
is what it does: first, it sets $= to an
environment variable that (at least under Apache)
indicates the length of the POSTed content, if any.
Then, using the trinary conditional operator
(foo ? bar : baz) it either reads the
POSTed content from standard input (if there is any)
or otherwise grabs the GET query string from another
environment variable. Either way, it's now got
whatever input is coming from the browser, which it
then splits on ampersands (the standard CGI field
separator), feeding the resulting list into the
foreach loop. (I spelled foreach as for
for brevity, a standard Perl Golf technique.) So,
each time through the foreach loop you've got what
amounts to the part of a CGI query between ampersands
(or between the beginning and the first amp, or
between the last and the end). The body of the
loop undoes the character encoding that CGI does and
splits it into a name/value pair. (CGI separates the
name from the value with =.) The name
and value get assigned to $: and
$, respectively, but that's just
temporary, since the very next statement uses these
variables as a key/value pair which it stores in the
%_ hash. I'll let you look up the
special variables $\ and $/
if you don't know; the former is used for its special
magic, and the latter is used for its default value.
Anyway, the map turns the list of keys into a list
of table rows with the keys and their respective
values interpolated, and the whole thing gets sent
to the browser. HTH.HAND.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
| [reply] [d/l] [select] |