allison has asked for the wisdom of the Perl Monks concerning the following question:
the output for that code is (^AU:sA-Z)ane smith, why is that? thanksmy $filename = "filename"; open my $file, '<', $filename; @fileinput=<$file>; close($file); foreach $line(@fileinput) { my $Cword=($line); if($Cword=~s/(^AU:\s[a-z])/(^AU:\s[A-Z])/) { print $Cword; } }
if($test=~s/AU:\s\b(\w+)\s\b(\w+)|AU:\s\b(w+)/AU: \u$1 \u$2/g) I tried this code to capital the first letter of each word the code is only valid with AU: Jane Smith but when in a file has a name of 'mr. carlos smith' it does not capitalize the each word. Is there any particular regex that i can use without using the Use Lingua::EN::NameCase.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Make the first letter of each word capitalize
by Eliya (Vicar) on Mar 20, 2011 at 10:37 UTC | |
|
Re: Make the first letter of each word capitalize
by wind (Priest) on Mar 20, 2011 at 15:42 UTC | |
|
Re: Make the first letter of each word capitalize
by Khen1950fx (Canon) on Mar 20, 2011 at 13:11 UTC |