You need to capture just the first word and replace it with uc $1. To make that work use the /e qualifier to the substitution which evaluates the replace ment as perl code.
my $words ='one two three'; $words =~ s/^([[:alpha:]]+)/ uc $1 /e; print $words; __END__ ONE two three
In reply to Re: Changing the first word to uppercase
by hipowls
in thread Changing the first word to uppercase
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |