Skip to Content
Programming PERL in the .NET Environment
book

Programming PERL in the .NET Environment

by Yevgeny Menaker, Michael Saltzman, Robert J. Oberg
September 2002
Intermediate to advanced content levelIntermediate to advanced
496 pages
10h
English
Addison-Wesley Professional
Content preview from Programming PERL in the .NET Environment

String Functions

There is a close relationship between an operator and a function. For example, Perl uses ** for exponentiation, whereas some languages use the pow function to achieve the same result. Likewise, Perl uses the % symbol for the remaindering operation, while other languages use the MOD function to achieve the same result. Thus, in this section we present some simple but useful functions that you can use on scalars.

The length Function

The length function returns the length of a scalar.

$string="This\tstring\nconsists\nof a few\nlines\n";
$len = length($string);                 #    length = 36

Remember that the \t sequence represents the tab character and the \n sequence represents the newline character. Thus, each of these sequences counts as a ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Sams Teach Yourself Perl in 21 Days, Second Edition

Sams Teach Yourself Perl in 21 Days, Second Edition

Laura Lemay, Rafe Colburn
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 0130652067Purchase book