Well, I sure wish I could beat that by my own code, but I couldn't even come close. I can improve on yours though. First of all: in a golf, you needn't use my and pre-declare variables. Second, I don't understand the need for this statement:
$_=join'',map{"$_\n"}@l[0,1,1,2,3,3,4];
Why not just use this
$_=join$/,@l[0,1,1,2,3,3,4];
Well, here's your improved code, it checks in at 223 chars:
sub f{
@c=qw[00700 00001 00000 75557 11111 71747
71717 55711 74717 74757 71111 75757 75717];
map{$l[$i++%5].=join'',(unpack("B8",chr)=~/(...)$/)[0,1,1,2],$"}
map{split//,$c[ord($_)-45]}split//,pop;
$_=join$/,@l[0,1,1..4];
tr/01/ X/;$_
}
The 15 year old, freshman programmer,
Stephen Rawls
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.