Hello
I am very new to Perl and was going through the old Perl obfuscated code contests. The curse-based skiing game caught my interest. I tried running it in bash but keep getting errors every time. What am I missing to be able to run this code?
undef $/;open(_,$0);/ \dx([\dA-F]*)/while(<_>);@&=split(//,$1);@/=@&;
$".=chr(hex(join("",splice(@&,0,2))))while(@&); eval$";
($C,$_,@\)=(($a=$/[1]*4)*5+1, q|
|x(0x20).q|\||.chr(32)x(0x10).q$*$.
chr(0x20)x(0x10).(pack("CC",124,10)),
sub{s/.\|(\s*?)(\S)./\|$1 $2/},
sub{s/\|(\s*?).(\S)/ \|$1$2 /},
sub{$2.$1.$3},sub{$tt=(3*$tt+7)%$C},
sub{$1.$3.$2});
while ($_) {
select $/, undef, $/, $C/1E3;
(sysread(STDIN, $k, 1), s/(.)(\*)(.)/(&{$\[(ord($k)-44&2)+2]})/e)
if (select($a=chr(1),$/,$/,0));
print 0x75736520504F5349583B2024743D6E657720504F5349583A3A5465
726D96F733B24742D3E676574617474722828303D3E2A5F3D5C2423292F32
293B2024742D3E7365746C666C61672824742D3E676546C666C6167267E28
4543484F7C4543484F4B7C4943414E4F4E29293B202742D3E736574636328
5654494D452C31293B24742D3E736574617474722802C544353414E4F5729
3B24643D224352415348215C6E223B0A;
($p?(/.{70}\|$/):(/^\|/))||(&{$\[3]}<$/[0])?($p=!$p):&{$\[$p]}||die("$
+d");
(&{$\[3]}<$/[1])&&(s/ \|$/\|/);
(/\|.*\*.*\|$/)||die("$d");
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.