Skip to content

Instantly share code, notes, and snippets.

@memowe
Created December 18, 2012 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memowe/4327686 to your computer and use it in GitHub Desktop.
Save memowe/4327686 to your computer and use it in GitHub Desktop.
# generate cool names
sub rand_name {
# split alphabet characters
my @vovels = qw(a e i o u);
my @consonants = grep {not $_ ~~ @vovels} 'a' .. 'z';
my %chars = (a => \@vovels, p => \@consonants);
# build name by template
my @templates = qw(papa paapa pappa papaa apa pap paap pappa);
my $template = @templates[rand @templates];
(my $name = $template) =~ s/./ ${$chars{$&}}[rand @{$chars{$&}}] /eg;
return $name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment