The length()
function in Perl is used to calculate the size of a string.
The illustration below shows the visual representation of the length()
function.
length(string)
The length()
function requires a string
as a parameter.
This function returns the size of a string
.
If the
string
parameter is omitted, then it returns''
.
#stringprint "length('Hello') : ".length('Hello'). "\n";#string with numberprint "length('EDUCATIVE09') : ".length('EDUCATIVE09'). "\n";#string is omittedprint "length() : ".length(). "\n";