my $fCnt = $fileText =~ /First\sName/g; die qq{"First Name" occurs more than once\n} if $fCnt > 1; my $lCnt = $fileText =~ /Last\sName/g; die qq{"Last Name" occurs more than once\n} if $lCnt > 1;