Original Code<p><pre><code> $_='^#(/||/@!@[{@:^[-['^";@@@\\>])@.".
"{)/];)^{";$,+=(++$,);$_.=">&$,";`$_`;
</code></pre>
$ man perlop<p>= Assignment Operator.<p>. Concatenation Operator.<p>.= Concatenate and Assign.<p>^ Binary XOR. The binary "^" and "|" operators have lower precedence
than relational operators like concatenate.<p>' Text between single quotes is an uninterpreted string.<p>" Text between double quotes is an interpreted string.<p>; Statement terminator, just like C, java, javascript, ...<p>$ man perlvar<p>$_ The default input and pattern-searching space. A lot of perl
code operates on this variable by default.<p>$, The output field separator for the print operator. If defined,
this value is printed between each of print's arguments. The default is
"undef".<p>The first statement is:<p>$_='^#(/||/@!@[{@:^[-['^";@@@\\>])@."."{)/];)^{";<p>String1: '^#(/||/@!@[{@:^[-['<p>String2: ";@@@\\>])@."<p>String3: "{)/];)^{"<p>So we get:<p>Result = String1 XOR String2 CONCAT String3<p>Since XOR has a lower precedence than Concatenate, we Concatenate first
and then do the XOR.<p><pre><code> # First String:
$_='^#(/||/@!@[{@:^[-[';
printf "HEX1: %*v2.2X\n", ' ', $_;
print "STR1: " . $_ . "\n";
$str1 = $_;
# OUTPUT:
# HEX1: 5E 23 28 2F 7C 7C 2F 40 21 40 5B 7B 40 3A 5E 5B 2D 5B
# STR1: ^#(/||/@!@[{@:^[-[
# Second String:
$_=";@@@\\>])@.";
printf "HEX2: %*v2.2X\n", ' ', $_;
print "STR2: " . $_ . "\n";
$str2 = $_;
# OUTPUT:
# HEX2: 3B 40 40 40 5C 3E 5D 29 40 2E
# STR2: ;@@@\>])@.
# Third String:
$_="{)/];)^{";
printf "HEX3: %*v2.2X\n", ' ', $_;
print "STR3: " . $_ . "\n";
$str3 = $_;
# OUTPUT:
# HEX3: 7B 29 2F 5D 3B 29 5E 7B
# STR3: {)/];)^{
# Since the "^" binary XOR operator has lower precedence
# than the "." concatenation operator, XOR str2 and str3 to
# get the Fourth String:
$_ = $str2 . $str3;
printf "HEX4: %*v2.2X\n", ' ', $_;
print "STR4: " . $_ . "\n";
$str4 = $_;
# OUTPUT:
# HEX4: 3B 40 40 40 5C 3E 5D 29 40 2E 7B 29 2F 5D 3B 29 5E 7B
# STR4: ;@@@\>])@.{)/];)^{
# Now we can do a binary XOR on Sring #1 and String #4 to
# get Fifth String:
$_ = $str1 ^ $str4;
printf "HEX5: %*v2.2X\n", ' ', $_;
print "STR5: " . $_ . "\n";
$str5 = $_;
# OUTPUT:
# HEX5: 65 63 68 6F 20 42 72 69 61 6E 20 52 6F 67 65 72 73 20
# STR5: echo Brian Rogers
# This is wickedly bad juju. The "(++$,)" portion increments an
# undefined variable and would normally be an error, but with errors and
# warnings shut off, it increments an undefined variable to 1, then adds
# it to itself with "+=" to get 2.
$,+=(++$,);
# Here we concatenate shell redirection to stderr, which is file
# descriptor 2, with the usual ">&2" since "$," now equals 2.
$_.=">&$,";
print "\n";
printf "HEX-: %*v2.2X\n", ' ', $_;
print "STR-: " . $_ . "\n";
# OUTPUT:
# HEX-: 65 63 68 6F 20 42 72 69 61 6E 20 52 6F 67 65 72 73 20 3E 26 32
# STR-: echo Brian Rogers >&2
# Finally, the statement is evaluated in the shell:
`$_`;
</code></pre>
Note: You should ask your friend Brian Rodgers if he always writes his
name to Standard ERROR! ;)