|
|
|
Ask HN: Any ideas what code this is?
|
|
4 points
by ahmett
4350 days ago
|
|
$_='^#(/||/@!@[{@:^[-['^";@@@\\>])@.".
"{)/];)^{";$,+=(++$,);$_.=">&$,";`$_`;
Saw it in a colleague's email signature. Seemed like Perl to me but I don't know Perl at all, certainly not at this level. So any ideas? |
|
= Assignment Operator.
. Concatenation Operator.
.= Concatenate and Assign.
^ Binary XOR. The binary "^" and "|" operators have lower precedence than relational operators like concatenate.
' Text between single quotes is an uninterpreted string.
" Text between double quotes is an interpreted string.
; Statement terminator, just like C, java, javascript, ...
$ man perlvar
$_ The default input and pattern-searching space. A lot of perl code operates on this variable by default.
$, The output field separator for the print operator. If defined, this value is printed between each of print's arguments. The default is "undef".
The first statement is:
$_='^#(/||/@!@[{@:^[-['^";@@@\\>])@."."{)/];)^{";
String1: '^#(/||/@!@[{@:^[-['
String2: ";@@@\\>])@."
String3: "{)/];)^{"
So we get:
Result = String1 XOR String2 CONCAT String3
Since XOR has a lower precedence than Concatenate, we Concatenate first and then do the XOR.
Note: You should ask your friend Brian Rodgers if he always writes his name to Standard ERROR! ;)