There is a function ucwords() in PHP which capitalizes the first letter of each word.
I have written a sub-routine in Perl, which gives the same functionality.
PHP Code:
<?
$str = "programming forums";
$str = ucwords($str);
// now $str = "Programming Forums"
?>
Code: Perl
sub ucwords
{
$str = shift;
$str = lc($str);
$str =~ s/\b(\w)/\u$1/g;
return $str;
}
$str = "programming forums";
$str = &ucwords($str);
# now $str = "Programming Forums"
