http://qs321.pair.com?node_id=57420

A one liner to produce Title Case (i.e. Set The First Letter Of Each Word Of A Phrase To Upper-case). This gives two examples:

  1. To title case a phrase specified in the same one liner
  2. To title case a whole file.
  3. Note:
    I set the split command to assume that words are separated by whitespace, commas, or dashes--but there's sure to be an exception,you see. This can be modified, though.

    My system wants me to use double quotes when I do a perl -e. This is why I use a qq at the end.

    update:As danger says, there is an existing FAQ on this at How do I capitalize all the words on one line?. I didn't turn it up in my initial search (I tried title case, upper case, etc.)

    thanks, danger and arhuman

Phrase in one-liner
perl -e "$_='ZENO WAS HERE';@ph=map {ucfirst(lc)} split(/[\s.,-]+/);pr +int qq(@ph)"
Phrase in separate file
perl -p -e "@ph=map {ucfirst(lc)} split(/[\s.,-]+/);print qq(@ph)" c:\ +foo.dat

update: arhuman sent me this smart variation (it leaves a trailing space, but is shorter):

perl -e '$_="ZENO WAS HERE"; print map {ucfirst(lc)," "} split/\s+/'