ucfirst Function in Perl

What is ucfirst Function in Perl?

Explanation

The ucfirst function is used to returns a string with first letter in upper case.

Syntax:


ucfirst(string)

In the above syntax, ucfirst() takes a "string" as the argument.

Example :


#! C:programfilesperlbinperl
print "content-type: text/htmlnn";
$string = "good day";
$string2 = ucfirst($string);
print "First letter in Upper Case: $string2n";
Result :

First letter in Upper Case: Good day

In the above ucfirst function example in the string "good day" the first letter "g" is converted to uppercase "G".

Ask Questions

Ask Question