I love the new "pick" method of lists in Perl 6. Here's a handy Shakespearean insult generator (cf https://kyclark.gitbooks.io/metagenomics/content/arrays.html):

#!/usr/bin/env perl6

sub MAIN (Int :$n=1) {
my @adjectives = qw{scurvy old filthy scurilous lascivious
foolish rascaly gross rotten corrupt foul loathsome irksome
heedless unmannered whoreson cullionly false filthsome
toad-spotted caterwauling wall-eyed insatiate vile peevish
infected sodden-witted lecherous ruinous indistinguishable
dishonest thin-faced slanderous bankrupt base detestable
rotten dishonest lubbery};
my @nouns = qw{knave coward liar swine villain beggar
slave scold jolthead whore barbermonger fishmonger carbuncle
fiend traitor block ape braggart jack milksop boy harpy
recreant degenerate Judas butt cur Satan ass coxcomb dandy
gull minion ratcatcher maw fool rogue lunatic varlet worm};

printf "You %s, %s, %s %s!\n",
@adjectives.pick(3), @nouns.pick for ^$n;
$ ./insult.pl6 -n=5
You loathsome, toad-spotted, scurvy knave!
You old, indistinguishable, false jolthead!
You ruinous, dishonest, scurvy fool!
You bankrupt, corrupt, sodden-witted dandy!
You peevish, sodden-witted, lubbery beggar!

Leave a comment

About Ken Youens-Clark

user-pic I work for Dr. Bonnie Hurwitz at the University of Arizona where I use Perl quite a bit in bioinformatics and metagenomics. I am also trying to write a book at https://www.gitbook.com/book/kyclark/metagenomics/details. Comments welcome.