Fixed a bug that could prevent name parsing in some cases.
[migration-tools.git] / unicorn / unicorn_patrons_to_tsv.pl
index 047ba97..12b4371 100755 (executable)
@@ -61,7 +61,7 @@ while (<>) {
                next;
        }
 
-       # Is this line the beginning of a block of data (typically an address or a note)?
+       # Is this line the end of a block of data (typically an address or a note)?
        if ( /^\.(.*?)_END.$/ ) {
                if ("$1." ne $section) {
                        print STDERR "Error in record $serial, line $line (input line $.): got an end-of-$1 but I thought I was in a $section block!\n";
@@ -175,7 +175,7 @@ for (my $u = 0; $u < @records; $u++) {
        }
 
        # Strip off a prefix, if there is one
-       foreach $prefix (qw( Ms. Mrs. Mr. Dr. )) {
+       foreach $prefix (qw( Ms\. Mrs\. Mr\. Dr\. )) {
                if ($temp_name =~ /$prefix /i) {
                        $records[$u]{'l_prefix_name'} = $prefix;
                        $temp_name =~ s/$prefix //i;
@@ -183,7 +183,7 @@ for (my $u = 0; $u < @records; $u++) {
        }
 
        # Strip off a suffix, if there is one
-       foreach $suffix (qw( Jr. Sr. II III IV )) {
+       foreach $suffix (qw( Jr\. Jr Sr\. Sr II III IV )) {
                if ($temp_name =~ / $suffix/i) {
                        $records[$u]{'l_suffix_name'} = $suffix;
                        $temp_name =~ s/ $suffix//i;