On 4/6/07, oryann9 <[EMAIL PROTECTED]> wrote:
$field =~ s/\b(.)(.*?)\b/\u$1\L$2/g; $record .= "$field|"; ************************** Is this regex s/\b(.)(.*?)\b/ saying boundry between any character zero or more times in $1 up to everything else non-greedy end word boundry in $2 sort of confused since your end goal is to CAPS first letter in words.
snip You are misreading the regex. It matches a word boundary followed by one character (captured $1) followed by zero or more characters non-greedily (captured $2) followed by a word boundary. The goal is not to capitalize the first character; it is to have only the first character capitalized. Rob Dixon else posted a better regex though. His takes advantage of a fact I didn't know: you can stack \u and \L. s/(\S+)/\u\L$1/g; So mine should be s/\b(.*?)\b/\u\L$1/g; Which one you use depends on whether you want "FOO-BAR" to be "Foo-Bar" (mine) or "Foo-bar" (his). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/