Perlfunc: Proper

Perl function to take take make it proper case. This should just capitalize the first letter of every word.

sub proper {
    my ($string) = @_;
    my @new_words,$word,@words,$new_string;

    @words = split (/\s/, $string);
    foreach $word (@words) {
        $new_word = ucfirst lc $word;
        push (@new_words, $new_word);
    }
    $new_string = join(" ", @new_words);
    return ($new_string);
}


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.16.70.99
To prevent spam please submit by clicking the kitten: