Previous <--> Next <==> All
#!/usr/local/bin/perl -s
$ENV{'PATH'} .= ":$ENV{'HOME'}/l/fun/bin:" .
                "$ENV{'HOME'}/l/fun/bin/$ENV{'ARCHIT'}:" .
                "/usr/local/games:/usr/games";
$ENV{'PATH'} .= ":/u/kinzler/l/fun/bin:/u/kinzler/l/fun/bin/sun4";

$dfltnum  = 5;
$dicturl  = 'http://www-lj.eb.com/cgi-bin/mweb?book=Dictionary&va=';	# free
#$dicturl = 'http://www.eb.com:180/cgi-bin/g?DBase=Dictionary&keywords=';

# haiku - front-end for haiku spewer
# Development version 11: add full text of HTML page
# Steve Kinzler, kinzler@cs.indiana.edu, Jan 96

$usage = "usage: $0 [ -t ] [ -d ] [ -l ] [ number ]
        -t      output text format, haiku only (default full HTML page)
        -d      don't include dictionary links in HTML output
        -l      output single-line haiku format (default multi-line format)
The given number of haiku are generated, default $dfltnum.\n";
die $usage if $h || $ARGV[0] !~ /^\d*$/;

$d   = $d       || ! $dicturl;
$num = $ARGV[0] || $dfltnum;

###############################################################################

open(HAIKU, "spew $num haikus |") || die "$0: cannot run spew ($!)";

unless ($t) {
        while (<DATA>) {
                print;
        }
}

$* = 1;

while (<HAIKU>) {
        $_ = "\u$_";

        unless ($l) {
                s:^:\n: if $. > 1;
                s: / :,\n:g;
        }

        unless ($t) {
                s/\w+/<a href="$dicturl$&">$&<\/a>/g, s/> +/>\n/g unless $d;
                s/,\n/,<br>\n/g;
                s/\.\n/.<p>\n/;
        }

        print;
}

print <<EOF unless $t;
</i></blockquote>

Reload this page for more haiku.

<hr>

<address>
<a href="/hyplan/kinzler.html">Steve Kinzler</a>,
<a href="mailto:kinzler@cs.indiana.edu">kinzler@cs.indiana.edu</a>
</address></body></html>
EOF

close HAIKU;

###############################################################################

__END__
<html><head>
<title>Random Word Haiku</title>
<link rev="made" href="mailto:kinzler@cs.indiana.edu">
<meta name="resource-type" content="document">
<meta name="description"
content="Generates haiku composed of randomly selected words.">
<meta name="keywords"
content="haiku, random, syllable, meaning, vocabulary, bizarre">
<meta name="distribution" content="global">
</head><body>

<h1>Random Word Haiku</h1>

Haiku is an honored form of poetry of Japanese origin.  Its unrhymed three
lines contain usually 5, 7 and 5 syllables respectively.  Yet even within
these strict constraints, haiku poets write with subtlety and depth.<p>

Random word haiku borrows the verse form of haiku, but uses words chosen
at random to fit the syllable structure.  Of course, any meaning in such
verse is accidental, yet it can be surprising how often it can seem to
be more meaningful, whether profound, humorous or just delightfully
bizarre, than chance would allow.  Random word haiku elicits meaning
from our own knowledge and connections between concepts.  The fact
that English allows nouns to be used as adjectives helps, too.<p>

Please see the
<a href="http://www.yahoo.com/Arts/Literature/Poetry/Haiku/">Haiku
links at Yahoo</a> for other haiku pages, both authentic and computer
generated.<p>

<a name="haiku"><hr></a>

I hope you enjoy the random word haiku poems generated for you below.
They were selected out of 5.75 x 10^30 possible ones (a nicely
coincidental number).
Since the vocabulary can be obscure, each word is linked to its entry in
Mirriam-Webster's Collegiate Dictionary.  These links may not work unless
you have access to the <a href="http://www.eb.com">Britannica Online</a>
website.
<p>

<blockquote><i>