What is the string.ucfirst() function in Perl?
The ucfirst() function in Perl converts the first character of a string to uppercase.
The following figure shows a visual representation of the ucfirst() function.
Syntax
ucfirst(string)
Parameter
As a parameter, the ucfirst() function requires a string whose first character is to be converted to uppercase.
Return value
The ucfirst() function converts the first character of a string to uppercase.
The rest of the string i.e. other than the first character, stays the same.
If the
stringparameter is omitted, then it returns$_.
Code
#stringprint "ucfirst('educative') : ".ucfirst('educative'). "\n";#string with numberprint "ucfirst('educaTive09') : ".ucfirst('educaTive09'). "\n";#string is omittedprint "ucfirst() : ".ucfirst(). "\n";