Perl Tutorial : Perl data types
Perl Tutorial : Perl Operators
Perl Tutorial : Perl loops
Perl Tutorial : Perl Conditionals
Perl Tutorial : Perl Subroutines
Perl Tutorial : Perl regex
Perl Tutorial : Perl Files
Perl Tutorial : Perl & Databases
Perl Tutorial : Perl OOPs
Perl Tutorial : Perl signals
Perl Tutorial : Perl threads
Perl Tutorial : Perl Debugging

Introcution to Perl CGI

Introduction to modperl
Home >> perlfunctions >>

Perl function: length

Syntax:
length STR
length
Returns the number of characters in the string, STR. If STR is missing, value stored in $_ will be used.

Example:

my $str = "Test String";
my $str_len = length($str);
print "Length of $str is $str_len";
Output:
Length of Test String is 11
It's a good practice to put STR in parenthesis to avoid confusion. The function length works only on strings. It won't work on arrays or hash.

Perl functions

scalars and strings

lc
ord

regex (regular expressions)

arrays

shift
split

More..

eval
Share |

List of all perl functions
Perl function : split
Perl function: abs
Perl function: chomp
Perl function: chop
Perl function: chr
Perl function: crypt
Perl function: eval
Perl function: hex
Perl function: lc
Perl function: lcfirst
Perl function: oct
Perl function: ord
Perl function: shift

Perl examples

  • How to use Data::Dumper?
  • How to parse config file?
  • Include external module in perl..
  • Download perl

    download stable version of perl
    Perl 5.10.1
    Perl interview Questions
    sed tutorial
    awk tutorial

    Join us on Google Groups

    Subscribe to perl
    Email:
    Visit this group
    Perl Jobs


    privacy | sitemap | disclaim | contact us
    © 2009 perlhome.com