I had a need to write a script that would give me a random first name.  I grabbed the top 200 first names for baby boys in the US from 2000-2009, and the same list for baby girls:


Boys Girls
Jacob Emily
Michael Madison
... ...

My initial implementation just printed out the name, but I quickly realized I needed to print out the gender if I wanted to talk about what the (fictitious) person did.  So I updated it to print out the gender as well.

In the course of this I realized that some names appeared on both lists.  In particular they are:

  • Alexis
  • Angel
  • Jordan
  • Peyton
  • Riley

The script is called like this:

>perl -w name.pl
Wesley (male)

And here's the source:

use strict;

# prints a randomly chosen name

sub read_words();

my @words = read_words();
print $words[ rand(@words) ];

sub read_words() {
    my @words = <DATA>;

    chomp @words;

    return @words;
Aaliyah (female)
Aaron (male)
Abby (female)
Abigail (female)
Abraham (male)
Adam (male)
Addison (female)
Adrian (male)
Adriana (female)
Adrianna (female)
Aidan (male)
Aiden (male)
Alan (male)
Alana (female)
Alejandro (male)
Alex (male)
Alexa (female)
Alexander (male)
Alexandra (female)
Alexandria (female)
Alexia (female)
Alexis (female)
Alexis (male)
Alicia (female)
Allison (female)
Alondra (female)
Alyssa (female)
Amanda (female)
Amber (female)
Amelia (female)
Amy (female)
Ana (female)
Andrea (female)
Andres (male)
Andrew (male)
Angel (female)
Angel (male)
Angela (female)
Angelica (female)
Angelina (female)
Anna (female)
Anthony (male)
Antonio (male)
Ariana (female)
Arianna (female)
Ashley (female)
Ashlyn (female)
Ashton (male)
Aubrey (female)
Audrey (female)
Austin (male)
Autumn (female)
Ava (female)
Avery (female)
Ayden (male)
Bailey (female)
Benjamin (male)
Bianca (female)
Blake (male)
Braden (male)
Bradley (male)
Brady (male)
Brandon (male)
Brayden (male)
Breanna (female)
Brendan (male)
Brian (male)
Briana (female)
Brianna (female)
Brittany (female)
Brody (male)
Brooke (female)
Brooklyn (female)
Bryan (male)
Bryce (male)
Bryson (male)
Caden (male)
Caitlin (female)
Caitlyn (female)
Caleb (male)
Cameron (male)
Camila (female)
Carlos (male)
Caroline (female)
Carson (male)
Carter (male)
Cassandra (female)
Cassidy (female)
Catherine (female)
Cesar (male)
Charles (male)
Charlotte (female)
Chase (male)
Chelsea (female)
Cheyenne (female)
Chloe (female)
Christian (male)
Christina (female)
Christopher (male)
Claire (female)
Cody (male)
Colby (male)
Cole (male)
Colin (male)
Collin (male)
Colton (male)
Conner (male)
Connor (male)
Cooper (male)
Courtney (female)
Cristian (male)
Crystal (female)
Daisy (female)
Dakota (male)
Dalton (male)
Damian (male)
Daniel (male)
Daniela (female)
Danielle (female)
David (male)
Delaney (female)
Derek (male)
Destiny (female)
Devin (male)
Devon (male)
Diana (female)
Diego (male)
Dominic (male)
Donovan (male)
Dylan (male)
Edgar (male)
Eduardo (male)
Edward (male)
Edwin (male)
Eli (male)
Elias (male)
Elijah (male)
Elizabeth (female)
Ella (female)
Ellie (female)
Emily (female)
Emma (female)
Emmanuel (male)
Eric (male)
Erica (female)
Erick (male)
Erik (male)
Erin (female)
Ethan (male)
Eva (female)
Evan (male)
Evelyn (female)
Faith (female)
Fernando (male)
Francisco (male)
Gabriel (male)
Gabriela (female)
Gabriella (female)
Gabrielle (female)
Gage (male)
Garrett (male)
Gavin (male)
Genesis (female)
George (male)
Gianna (female)
Giovanni (male)
Giselle (female)
Grace (female)
Gracie (female)
Grant (male)
Gregory (male)
Hailey (female)
Haley (female)
Hannah (female)
Hayden (male)
Hector (male)
Henry (male)
Hope (female)
Hunter (male)
Ian (male)
Isaac (male)
Isabel (female)
Isabella (female)
Isabelle (female)
Isaiah (male)
Ivan (male)
Jack (male)
Jackson (male)
Jacob (male)
Jacqueline (female)
Jada (female)
Jade (female)
Jaden (male)
Jake (male)
Jalen (male)
James (male)
Jared (male)
Jasmin (female)
Jasmine (female)
Jason (male)
Javier (male)
Jayden (male)
Jayla (female)
Jazmin (female)
Jeffrey (male)
Jenna (female)
Jennifer (female)
Jeremiah (male)
Jeremy (male)
Jesse (male)
Jessica (female)
Jesus (male)
Jillian (female)
Jocelyn (female)
Joel (male)
John (male)
Johnathan (male)
Jonah (male)
Jonathan (male)
Jordan (female)
Jordan (male)
Jordyn (female)
Jorge (male)
Jose (male)
Joseph (male)
Joshua (male)
Josiah (male)
Juan (male)
Julia (female)
Julian (male)
Juliana (female)
Justin (male)
Kaden (male)
Kaitlyn (female)
Kaleb (male)
Karen (female)
Karina (female)
Kate (female)
Katelyn (female)
Katherine (female)
Kathryn (female)
Katie (female)
Kayla (female)
Kaylee (female)
Kelly (female)
Kelsey (female)
Kendall (female)
Kennedy (female)
Kenneth (male)
Kevin (male)
Kiara (female)
Kimberly (female)
Kyle (male)
Kylee (female)
Kylie (female)
Landon (male)
Laura (female)
Lauren (female)
Layla (female)
Leah (female)
Leonardo (male)
Leslie (female)
Levi (male)
Liam (male)
Liliana (female)
Lillian (female)
Lilly (female)
Lily (female)
Lindsey (female)
Logan (male)
Lucas (male)
Lucy (female)
Luis (male)
Luke (male)
Lydia (female)
Mackenzie (female)
Madeline (female)
Madelyn (female)
Madison (female)
Makayla (female)
Makenzie (female)
Malachi (male)
Manuel (male)
Marco (male)
Marcus (male)
Margaret (female)
Maria (female)
Mariah (female)
Mario (male)
Marissa (female)
Mark (male)
Martin (male)
Mary (female)
Mason (male)
Matthew (male)
Max (male)
Maxwell (male)
Maya (female)
Mckenzie (female)
Megan (female)
Melanie (female)
Melissa (female)
Mia (female)
Micah (male)
Michael (male)
Michelle (female)
Miguel (male)
Mikayla (female)
Miranda (female)
Molly (female)
Morgan (female)
Mya (female)
Naomi (female)
Natalia (female)
Natalie (female)
Nathan (male)
Nathaniel (male)
Nevaeh (female)
Nicholas (male)
Nicolas (male)
Nicole (female)
Noah (male)
Nolan (male)
Oliver (male)
Olivia (female)
Omar (male)
Oscar (male)
Owen (male)
Paige (female)
Parker (male)
Patrick (male)
Paul (male)
Payton (female)
Peter (male)
Peyton (female)
Peyton (male)
Preston (male)
Rachel (female)
Raymond (male)
Reagan (female)
Rebecca (female)
Ricardo (male)
Richard (male)
Riley (female)
Riley (male)
Robert (male)
Ruby (female)
Ryan (male)
Rylee (female)
Sabrina (female)
Sadie (female)
Samantha (female)
Samuel (male)
Sara (female)
Sarah (female)
Savannah (female)
Sean (male)
Sebastian (male)
Serenity (female)
Sergio (male)
Seth (male)
Shane (male)
Shawn (male)
Shelby (female)
Sierra (female)
Skylar (female)
Sofia (female)
Sophia (female)
Sophie (female)
Spencer (male)
Stephanie (female)
Stephen (male)
Steven (male)
Summer (female)
Sydney (female)
Tanner (male)
Taylor (female)
Thomas (male)
Tiffany (female)
Timothy (male)
Travis (male)
Trenton (male)
Trevor (male)
Trinity (female)
Tristan (male)
Tyler (male)
Valeria (female)
Valerie (female)
Vanessa (female)
Veronica (female)
Victor (male)
Victoria (female)
Vincent (male)
Wesley (male)
William (male)
Wyatt (male)
Xavier (male)
Zachary (male)
Zoe (female)
Zoey (female)