length Function in Perl

What is length Function in Perl?


The length function returns the number of bytes in a string.


length EXPR

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

Example :

#! C:programfilesperlbinperl
print "content-type: text/htmlnn";
$string = "Hioxindia";
$string2 = length($string);
print "Length of the string is: $string2n";
Result :

Length of the string is: 9

In the above length Function example the length of the string "Hioxindia" is calculated and displayed as "9".

Ask Questions

Ask Question