in reply to Mixing the case of a line

Depending on your definition of "word" and whether or not you have multiple spaces between "words" something like this might work:
#!/usr/bin/perl -wT use strict; my $string = 'abc def GHI JkLMno pQrSTUv'; my @words = map {ucfirst(lc($_))} split(' ',$string); # Abc Def, etc. +.. $words[-1] = uc($words[-1]); # PQRSTUV my $newstring = join(' ',@words); # back together print "$newstring\n"; __END__ =head1 OUTPUT Abc Def Ghi Jklmno PQRSTUV
You should probably read about uc, lc, and ucfirst.

-Blake

Replies are listed 'Best First'.
Re: Re: Mixing the case of a line
by Joes (Acolyte) on Nov 16, 2001 at 06:43 UTC
    Thanks to you all. It had me beaten how to uppercase the last word of a line, which may be hyphenated as in Smith-Jones.
    It is not homework but part of my genealogy, where I get Birth, Death, Marriage certificates forwarded electronically, but they are all uppercase text.
    Thanks also for the direction and reference material