in reply to Capitalize First Letter of Each Word

#! /usr/bin/perl -w use strict; while (<DATA>) { s/\b(\w)(\w*)/uc($1).lc($2)/ge; print; } __DATA__ THIS iS a Text IN TITLE CASE THIS IS TESTING JOE MARCONES RESIDENTIAL MAINTENANCE COMPANY

Replies are listed 'Best First'.
Re^2: Capitalize First Letter of Each Word
by rev_1318 (Chaplain) on Jun 30, 2005 at 14:07 UTC
    or just:
    ... s/\b(\w)(\w*)/\U$1\L$2/g ...
    no need for /ie...

    Paul

      and the \b isn't needed either as the regex will match as many word characters as possible each time.
Re^2: Capitalize First Letter of Each Word
by Your Mother (Archbishop) on Jul 11, 2005 at 21:03 UTC

    Mmmmmmm...

    __DATA__ This isn't right And I'm wrong too e-mail is nice when capped correctly &c