<?xml version="1.0" encoding="windows-1252"?>
<node id="474186" title="Bits &amp; pieces" created="2005-07-12 03:08:01" updated="2005-08-15 02:18:04">
<type id="1588">
obfuscated</type>
<author id="375665">
bobf</author>
<data>
<field name="doctext">
&lt;p&gt;
This started as a test script while I was learning about bit operations, and it slowly evolved into an obfuscated JAPH.  I know it exceeds the traditional "[id://412464|4 line rule]", but I thought that it would be fun to limit the digits used to only 0 and 1, given the theme.  It was not golfed in any way.
&lt;/p&gt;
&lt;p&gt;
Enjoy!
&lt;/p&gt;
&lt;code&gt;

$_=[[[[{},[]],{0111,'01110111',1000,'11100101'},[[]]],{0001,'01111110'
,0110,'00011010',0100,'011001000011111001111010',0010,'00000100',0011,
'01010101000100000001111110100010101000000000101000110000010001001010'
.'10100',0101,'011100001001010100000001'},[[]]]];%_=%{${${$_}[0]}[1]};
$s=eval{$O=0,$C=0,$t='This is my 100th PM post';sub{$O++,$C=@_?$C:eval
pack('b*',vec(pack('b*',$_{1&lt;&lt;(1&lt;&lt;0&lt;&lt;1)*((1&lt;&lt;0+1&lt;&lt;0)+1&lt;&lt;0)}),$O-1,1&lt;&lt;0
)?$_{1&lt;&lt;0}:$_{1&lt;&lt;(1&lt;&lt;1&lt;&lt;1)-1}).$C.pack('c',vec(pack('b*',$_{1&lt;&lt;((1&lt;&lt;0)
+(1&lt;&lt;1*1&lt;&lt;1)+1&lt;&lt;0)}),($O-1)%((1&lt;&lt;0*1&lt;&lt;1)+1&lt;&lt;0),1&lt;&lt;(1&lt;&lt;0+1&lt;&lt;0)+1)).pack
('b*',vec(pack('b*',$_{1&lt;&lt;((1&lt;&lt;0+1&lt;&lt;0)+(1&lt;&lt;1&lt;&lt;1))}),$O-1,1)?$_{1&lt;&lt;((1+
1&lt;&lt;0)+1)}:$_{1&lt;&lt;0}).vec($t,$O-1,1&lt;&lt;(1&lt;&lt;1&lt;&lt;1)-(1&lt;&lt;0))};};;$o=pack('b*',
$_{((1&lt;&lt;1)**(1&lt;&lt;1)-1)**(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&lt;&lt;1))==0?(1&lt;&lt;(((1&lt;&lt;1*1&lt;&lt;1&lt;&lt;1
)+(1&lt;&lt;1&lt;&lt;1&gt;&gt;1))&gt;&gt;1)):0);&amp;$s}print pack('c',$s-&gt;(1&lt;&lt;0)^unpack('c',(pack
('b*',$_{(1&lt;&lt;1*1&lt;&lt;1*1&lt;&lt;1)*((1&lt;&lt;1)**(1&lt;&lt;0&lt;&lt;1)-1)**(1&lt;&lt;1&lt;&lt;1&gt;&gt;1&lt;&lt;0)}))));

&lt;/code&gt;
&lt;p&gt;
[bobf]
&lt;/p&gt;

&lt;p&gt;
Hint: the bit shifts are fun, but they aren't the main point of the obfuscation.
&lt;/p&gt;

&lt;p&gt;
&lt;small&gt;
Tested on
&lt;ul&gt;
&lt;li&gt;
perl 5.005_03 built for i386-linux (little endian)
&lt;/li&gt;
&lt;li&gt;
perl 5.6.0 built for sun4-solaris (big endian)
&lt;/li&gt;
&lt;li&gt;
perl 5.6.1 built for MSWin32-x86-multi-thread (little endian)
&lt;/li&gt;
&lt;li&gt;
perl 5.8.0 built for i386-linux-thread-multi (little endian)
&lt;/li&gt;
&lt;li&gt;
perl 5.8.3 built for i686-linux (little endian)
&lt;/li&gt;
&lt;li&gt;
perl 5.8.4 built for i386-linux-thread-multi (little endian)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/small&gt;
&lt;/p&gt;</field>
</data>
</node>
