VOOZH about

URL: https://www.geeksforgeeks.org/perl/perl-length-function/

⇱ Perl | length() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Perl | length() Function

Last Updated : 11 Jul, 2025
length() function in Perl finds length (number of characters) of a given string, or $_ if not specified.
Syntax:length(VAR) Parameter: VAR: String or a group of strings whose length is to be calculated Return: Returns the size of the string.
Example 1: Output:
Length of String is: 15
  Example 2: Output:
Length of String is: 20
Note : Scalar context on an array or hash is used if the corresponding size is to be determined.
Comment

Explore