http://www.perlmonks.org?node_id=86818


in reply to (Golf) LED Sign

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