in reply to making first letter of all words in array upper case

Thanks for the all of the responses. Okay, the script is only meant for ONE person to tell ONE other person about the site. If they entered mr. blah blah, I would like it to look like: Mr. Blah Blah.

Thanks to SuperCruncher, I have gotten the "From:" name field to have all uppercase first characters, but can't get the same to happen for the "To:" name field to do the same. I know it has something to do with the $_ variable (I think?)

# make the first letters of the NAME of the sender uppercase my @from = split(/ /, $from); $_ = ucfirst for @from; # make the first letters of the NAME of the receiver uppercase my @to = split(/ /, $to); $_ = ucfirst for @to; # make the first letter of the message upper case $message = ucfirst($message);

As for using a regex for the next part, I am lost :(
How can I use this line: $string .= '.' if $string !~ /[.!?]$/; in the code below?

############################################## # puts a period at the end of senders message, # if one was not there, AND, if there is no # question OR explanation mark. my $length = length($message); my $period = index($message, "."); my $question = index($message, "?"); my $explanation = index($message, "!"); $length = $length - 1; if (($period ne $length) && ($question ne $length) && ($explanation ne + $length)) { $message = $message.'.'; } ##############################################

Replies are listed 'Best First'.
Re: Re: making first letter of all words in array upper case
by sauoq (Abbot) on Dec 31, 2002 at 20:33 UTC
    How can I use this line: $string .= '.' if $string !~ /[.!?]$/; in the code below?

    Change it to $message .= '.' if $message !~ /[.!?]$/; and just replace that whole block of code with that one line.

    But really, you should listen to merlyn's admonition and refrain from deploying this script!

    -sauoq
    "My two cents aren't worth a dime.";