In his book !# (pronounced “shebang”), Nick Montfort exhibits several short programs and the output of those programs. One program, PPG256-1 (Perl Poetry Generator 256, number 1) produces poetry from a dense Perl program of 256 characters.
In this session, we’ll look at PPG256-1 and how it does its magic, and perhaps talk about programming as both text and the creator of text.
PPG256-1:
sub b{@_=unpack"(A2)*",pop;$_[rand@_]}sub w{" ".b(cococacamamadebapanohamolaburatamihopodito).b(estsnslldsckregspsstedbsnelengkemsattewsntarshnknd)}{$_="\n\nthe".w."\n";$_=w." ".b(attoonnoof).w."\n" if $l;s/[au][ae]/a/;print;$l=0if$l++>rand 9;sleep 1;redo}