What is string.lcfirst() in Perl?

The lcfirst() function converts the first character of a string to lowercase.

The figure below shows a visual representation of the lcfirst() function.

Figure 1: Visual representation of lcfirst() function

Syntax

lcfirst(string)

Parameters

The lcfirst() function requires a string whose first character is to be converted to lowercase.

Return value

The lcfirst() function converts the first character of a string to lowercase. The rest of the string stays the same.

If the string parameter is omitted, then lcfirst() returns an empty string.

Code

#string
print "lcfirst('EDUCATIVE') : ".lcfirst('EDUCATIVE'). "\n";
#string with number
print "lcfirst('EDUCAtIVE09') : ".lcfirst('EDUCAtIVE09'). "\n";
#string is omitted
print "lcfirst() : ".lcfirst(). "\n";