Perl length Function
This function returns the length, in characters, of the value of EXPR, or $_ if not specified. Use scalar context on an array or hash if you want to determine the corresponding size.
Following is the simple syntax for this function −
length EXPR length
This function returns the size of string.
Following is the example code showing its basic usage −
#!/usr/bin/perl $orig_string = "This is Test and CAPITAL"; $string_len = length( $orig_string ); print "Length of String is : $string_len\n";
When above code is executed, it produces the following result −
Length of String is : 24