Copyright © tutorialspoint.com

PERL length Function


Syntax

length EXPR

length


Definition and Usage

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.

Return Value

    Size of string.

Example

Try out following example:

#!/usr/bin/perl

$orig_string = "This is Test and CAPITAL";

$string_len =  length( orig_string );

print "Length of  String is : $string_len\n";

It will produce following result

Length of  String is : 11


Copyright © tutorialspoint.com