Stefan Lidman <[EMAIL PROTECTED]> wrote:
> 
> David Gerler wrote:
> > 
> > Hi,
> >         I have a line of text that is all uppercase and I need to change it
> > to titlecase. i.e. "THIS IS THE LINE" needs to become "This Is The
> > Line". I can make it all lower case using tr///. I have researched in
> > my books and found that and the \u to for making the next character
> > titlecase but can't seem to make it work the way I want it too.
> > 
> > This is what I tried:
> >   $title =~ tr/A-Z/a-z/;
> 
>      
> try
>       $title =~ s/\b(\w)/\U$1/g;
> 
> $ perl -we '$_ = "THIS IS THE LINE"; tr/A-Z/a-z/; s/\b(\w)/\U$1/g; print
> "$_ \n"'
> This Is The Line
> 
> /Stefan Lidman
> >   $title =~ s/(\W)/\u$1/;
> 
Try 
$title =~ s/\b(\w+)\b/\u\L$1/g;
--
Irina

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to