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


in reply to Triangle Golf


This was attempt to see if using format() would be shorter. It wasn't. It does use some of Perl's dustier artifacts however:
#!/usr/bin/perl -wall -00n use strict; END{ @_=shift@F; while(@F){ $_=shift @F; $_.=' '.shift@F while(length$_<=length$_[-1]&&@F); push@_,$_ } formline(('@'.('|'x80)."\n")x@_,@_); print $^A }


Update: Using MeowChow's regex this can be reduced to 89 chars + 6 command line switches. I'm not proud of this:
#!/usr/bin/perl -w -00nal use strict; END{ $_="@F "; @F=1; formline'@'.('|'x80)."\n",$&and@F=length$&while/.{1,@F}.*? /g; print$^A }


John.
--