1. Home
  2. Computing & Technology
  3. Perl

Perl string length() function - Quick Tutorial

How to use the string length() function

From About.com

$RESULT = length(EXPRESSION);
Perl's length() function simply returns the length of a perl string in characters.
$myString = 'perl.about.com';
$myLength = length($myString);
In this example, we've created a string with the value perl.about.com. When we run the length function on the string, it will return 14, or the total number of characters in the string. Note that this does not count the size of the string in bytes - just the length in characters.
More Perl Quick Tips

Explore Perl

More from About.com

  1. Home
  2. Computing & Technology
  3. Perl
  4. Programming Perl
  5. Perl length function reference - learn how to use Perl's length() function in this quick tutorial.

©2008 About.com, a part of The New York Times Company.

All rights reserved.