in reply to Re^2: Changing the first word to uppercase
in thread Changing the first word to uppercase

I accidentally used lc where I should have used uc, but you shouldn't get the behaviour you describe either way.

>type infile hello h e l l o bye b y e bike b i k e >perl -pe"s/(.)/uc($1)/e" infile > outfile >type outfile Hello h e l l o Bye b y e Bike b i k e

or

>type infile hello h e l l o bye b y e bike b i k e >type script.pl while (<>) { s/(.)/uc($1)/e; print; } >perl script.pl infile > outfile >type outfile Hello h e l l o Bye b y e Bike b i k e

You must be doing something extra.

Replies are listed 'Best First'.
Re^4: Changing the first word to uppercase
by Anonymous Monk on Feb 14, 2008 at 00:58 UTC
    Sorry for disturbing again. for mu input such as below i get this out put:
    abandoned ax bcl b ae n dcl d en dcl d abdomen ae bcl b dcl d ow m en abdomen ae bcl b dcl d em en abdomen ae bcl b dcl d ax m ax n ABANDONED AX BCL B AE N DCL D EN DCL D bandoned ax bcl b ae n dcl d en dcl d ABDOMEN AE BCL B DCL D OW M EN bdomen ae bcl b dcl d ow m en ABDOMEN AE BCL B DCL D EM EN bdomen ae bcl b dcl d em en ABDOMEN AE BCL B DCL D AX M AX N
    which is not desired:(