SMITH, JOHN H. --becomes--> Smith, John H. #### Smith, John H. (JOHNNY) --becomes--> Smith, John H. (Johnny) #### SMITH, JOHN H. (JOHNNY) *CONTRACTOR* --becomes--> Smith, John H. (Johnny) *CONTRACTOR* #### #!/usr/bin/perl use strict; use warnings; my @names = ("Foonman, Joseph S. (Joe)", "SMITH, EDWARD", "Perl, Paul M. *CONTRACTOR*", "Jones, Bobby R.", "Ruth, BABE B. *CONTRACTOR*", "CLAUSE, SANTINO (SANTA)", ); for my $n (@names) { print join(" ", map( { if (/^\*/) { $_; } elsif (/^\(/) { "\(".ucfirst(lc(substr($_,1))); } else { ucfirst(lc($_)); } } split(/ /,$n)))."\n"; } #### Foonman, Joseph S. (Joe) Smith, Edward Perl, Paul M. *CONTRACTOR* Jones, Bobby R. Ruth, Babe B. *CONTRACTOR* Clause, Santino (Santa)