David Gilden am Freitag, 28. Oktober 2005 20.55:
> Hello,
>
> I am stuck with this issue.
> How do get each substring (the names in this case) and then upper case
> them. This does not work just yet....
>
> Possible data:
> mike smith
> john h. hamilton
> g. bush
> hendric
>
> etc......
> ----
>
> #!/usr/bin/perl
>
> $SendersName = " dave middlename gilden ";
> $SendersName =~ s/\s*(.+)\s*/$1/g;
> ($SendersName) = $SendersName =~ m/([\w\.-]{1,24}( [\w\.-]{1,24}){0,4})/;
> $SendersName =~ s/.+ (.+)? (.+){1,3}/\u$1 \u$2 \u$3/g;
> print "$SendersName\n";

use strict; 
use warnings;

my @names=('mike smith', 'john h. hamilton', 'g. bush', 'hendric');

for (@names) {
 print join ' ', map ucfirst, split /\s+/;
 print "\n";
}

Mike Smith
John H. Hamilton
G. Bush
Hendric


joe

>
>
> Thanks!
>
> Dave Gilden -- Ft. Worth
>
> Island Journey music video now online!
> <http://www.abbydigital.tk/>
>
> ================================================
>         Cora Connection: Your West African Music Source
>           Resources, Recordings, Instruments & More!
>               <http://www.coraconnection.com/>
> ================================================

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to