Or try: $key =~ s/(\w+)/\u$1/g Note, no need for the \w\w+ character class (in fact that doesn't work right) and remember the 'g' modifier, to do all words, not just the first.
Cheers Mark C > -----Original Message----- > From: fliptop [mailto:[EMAIL PROTECTED]] > Sent: 16 February 2002 14:07 > To: David Gilden > Cc: [EMAIL PROTECTED] > Subject: Re: regrex question > > > David Gilden wrote: > > > > > $key ="Departure date"; > > > > $key =~ s/([\w\w+])/\u$1/; > > > > > > ---> Desired result: > > > > Departure Date > > > > What is wrong the above regrex? > > > it's probably easier to use the ucfirst() function: > > my $key ="Departure date"; > my @result = map { ucfirst } split /\s+/, $key; > print join " ", @result, "\n"; > > this prints > > Departure Date > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]