Daft Perl

This is an example of "Perl golf". It prints the lyrics to the song "Harder Better Faster Stronger" by Daft Punk. Press the "start" button underneath the video to see it in action.


perl -e'@a=qw/Harder Better Faster Stronger/;use Time::HiRes"ualarm";@z=(0,2,4,
6);@v=("Work It","Make It","Do It","Makes Us");sub w{("")x$_[0]}$|=$t=432250;@f
=split"/","More Than/Ever/Hour/After/Our/Work Is/Never/Over";@e=((map{join(":",
@f[$_,$_+1])}@z),"");@w=map"$v[$_]:$a[$_]",0..3;@h=(@w,@e);@j=w(5);@t=(@v,@j,@a
,@j);@l=(@t,@f[@z],@j,(map{$f[$_+1]}@z),@j,@t,@w,@j,@e,w(4),(@h)x6,w(9),(@h)x7)
;ualarm$t,$t;$SIG{ALRM}=sub{print p()};a:goto a;sub p{if(($c++)%2){exit if!@l;
if($_=shift@l){if(/(.*):(.*)/){$s=$2;$1}else{"$_\n"}}}elsif($s){" $s\n",$s=""}}'
(This demonstration is in JavaScript, using the output of the above Perl script.)
Copyright © Ben Bullock 2009-2010. All rights reserved. For comments, questions, and corrections, please email Ben Bullock/ Privacy/ Disclaimer