On Wed, Sep 13, 2000 at 12:03:43AM -0400, John Porter wrote: > This wasn't F to begin with, and now the WP part is gone too. > Can't you find a better venue for this? I dunno, I thought the (essentially) one line recursive grammar parser was pretty slick. sub replace { my $line = shift; $line =~ s{(\b[A-Z]{2,}\b)} { exists $Rules{$1} ? replace(${$Rules{$1}}[rand @{$Rules{$1}}]) : $1 }eg; return $line; } The thinness of the code (you should see the C++ program this was adapted from!) plus the generic grammar of the rules makes this useful for any kind of pseudo-random tokenized response generator. It is, in effect, YACC in reverse. Generating a random, but syntactically correct, piece of code straight from a grammar definition. Or its a juvenile attempt at humor in poor taste. Your pick. PS If you thought this was raunchy, you should have seen the insult ruleset I have. -- Michael G Schwern http://www.pobox.com/~schwern/ schwern@pobox.com Just Another Stupid Consultant Perl6 Kwalitee Ashuranse But honestly, the more expensive the better. Just depend on how much you trust us. --Alex Chiu, Immortality Guy ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe