What is string.length() in Perl?
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.
Syntax
length(string)
Parameters
The length() function requires a string as a parameter.
Return value
This function returns the size of a string.
If the
stringparameter is omitted, then it returns''.
Code
#stringprint "length('Hello') : ".length('Hello'). "\n";#string with numberprint "length('EDUCATIVE09') : ".length('EDUCATIVE09'). "\n";#string is omittedprint "length() : ".length(). "\n";