#!/usr/bin/perl -w use strict; no strict 'subs'; # 27 letters and a space bar (5 spaces since the space bar is large :). my @keys = (A..Z, ' ', ' ', ' ', ' ', ' '); # Open log to print good words open(FH, ">>monkey.log") or die "No monkey ($!)"; select(FH); $|++; # Start a block { my $str; # Building a 572 char string, could be longer. for (1..572) { $str .= $keys[rand(@keys)]; } my @words = split(" ",$str); for (@words) { # Not too many 15+ char words, so skip em next if /\w{15,}/; my @spell = `echo $_ | ispell -a -S`; if (grep /^\*/, @spell) { # Good monkey! print $_ . " " unless !/[IA]/; next; } } # Keep redoing this block redo; }