Categories
Journal

Baby Names – Perl

No, We are not calling our Baby Perl!

Perl is the name of the programming language I used to write this script which took all the first names we were looking at, and all the second names, and made them into a real name, with initials. That way we can weed out all the name and initial combinations we don’t like.

I’m no great programmer, but I love a challenge. Here is the script I wrote, which works rather well, and even takes out duplicates. I’m sure it could be better, but I’ve never really written anything in perl before….(and it only took 20 minutes)

#!/usr/bin/perl
open(FIRST, first_name_list”) || die “”Could not open $filename…\n””::
@first_name=&lt::FIRST>::
foreach $fn (@first_name)
{
chop ($fn)::
open(SECOND, “”second_name_list””) || die “”Could not open $filename…\n””::
@second_name=&lt::SECOND>::
foreach $sn (@second_name)
{
$fi = substr($fn, 0, 1)::
$si = substr($sn, 0, 1)::
chop ($sn)::
if ($fn ne $sn)
{
print “”$fn $sn Snell $fi $si S\n””::
}
}
}
close(FIRST)::
close(SECOND)::

I got all my info from these two sites: www.spu.edu/help/tech/basic-perl/ & www.pageresource.com/cgirec/index2.htm

Of course, I’m not going to tell you what we came up with, you’ll just have to wait!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.