#!/usr/bin/perl #nb the poem is the output # licensed under the Gnu poetic licence (?!) open my $dict, "</usr/share/lib/dict/words" or open my $dict, "</usr/share/dict/words" or die "you call that a \'puter?\n"; my @words = <$dict>; my $count = 100*rand(); { use integer; $count /= 1; } for ( 0..$count ) { my $ptr = rand() * $#words; chomp $words[$ptr]; unless( $_ ) { $words[ $ptr ] =~ /^(.)(.*)$/; my $b = uc( $1 ); $words[$ptr ] = $b . $2; } if ( $_ < $count ) { print $words[$ptr]; print (( rand() > 0.9 )? ";\n" : ' '); } else { print $words[$ptr] . ".\n"; } }
-M
Free your mind
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Ode to a random number
by ambrus (Abbot) on Jun 19, 2006 at 14:09 UTC | |
|
Re: Ode to a random number
by Moron (Curate) on Jun 20, 2006 at 16:53 UTC | |
by CountZero (Bishop) on Jun 21, 2006 at 06:10 UTC | |
by Moron (Curate) on Jun 21, 2006 at 09:55 UTC | |
|
Re: Ode to a random number
by samizdat (Vicar) on Jun 20, 2006 at 13:18 UTC | |
by Moron (Curate) on Jun 20, 2006 at 13:28 UTC | |
by samizdat (Vicar) on Jun 20, 2006 at 16:12 UTC |