An Alphabet in 25 Characters

Thursday 19 May 2011, 8:26 pm   /////  

I’m here at the University at Buffalo enjoying the E-Poetry Festival. Amid this discussion of digital work, concrete poetry, and related innovative practices, and among this great crowd of poets, I’ve developed a very short piece for anyone with Perl installed to enjoy – just copy and paste on the command line:

yes | perl -pe '$.%=26;$_=$"x$..chr 97+$.'

It does use “yes,” one of my favorite Unix/GNU commands, and the -p option to wrap the Perl code in a loop. So there’s some bonus stuff there on the command line. But the Perl code itself is only 25 characters long, not a bad length for a program that displays the alphabet.

Alphabet in 25

1 Comment »

  1. Ah, I always forgot an optimization (or several). Here’s a 24-character version:

    yes | perl -pe '$.%=26;$_=$"x$..chr$.+97'

    Here’s a 35-character version which, saved as a file, will run in perl without command-line options:

    {$.%=26;print$"x$..chr$.+++97;redo}

    That is, save it as “abc.pl” and you can run it as “perl abc.pl”.

    Comment by Nick Montfort — 2011-05-21 @ 10:24 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2014 Post Position | Barecity theme