An Alphabet in 25 Characters

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

One Reply to “An Alphabet in 25 Characters”

  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”.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

This site uses Akismet to reduce spam. Learn how your comment data is processed.