Change first letter of a word to upper case with perl

Often while scripting, it requires to change the first letter of a word to upper case. Using perl with the below command, we can achieve this.

echo $word | perl -pe ‘s/^(.{0})(.)/$1\U$2/;’`

2 Responses to “Change first letter of a word to upper case with perl”


Leave a Reply