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

tx for ur help but it didnt work, it gave me the same line wid space after each line, it means my "word w o r d" now is "word w o r d word w o r d".....
  • Comment on Re^2: Changing the first word to uppercase

Replies are listed 'Best First'.
Re^3: Changing the first word to uppercase
by ikegami (Patriarch) on Feb 14, 2008 at 00:39 UTC

    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.

      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:(