Skip to Main Content
Perl Pocket Reference, 5th Edition
book

Perl Pocket Reference, 5th Edition

by Johan Vromans
July 2011
Intermediate to advanced content levelIntermediate to advanced
104 pages
2h 14m
English
O'Reilly Media, Inc.
Content preview from Perl Pocket Reference, 5th Edition

String Functions

chomp list

Removes $/ (page 70) from all elements of the list; returns the (total) number of characters removed.

chop list

Chops off the last character on all elements of the list; returns the last chopped character.

crypt plaintext, salt

Encrypts a string (irreversibly).

eval expr

Parses and executes expr as if it were a Perl program. The value returned is the value of the last expression evaluated. If there is a syntax error or runtime error, undef is returned by eval, and $@ is set to the error message. See also eval in page 63.

index str, substr [ , offset ]

Returns the position of substr in str at or after offset. If the substring is not found, returns –1.

lc expr

Returns a lowercase version of expr. See also \L in page 7.

lcfirst expr

Returns expr with its first character in lowercase. See also \l in page 7.

length expr

Returns the length in characters of expr.

quotemeta expr

Returns expr with all regular expression metacharacters quoted. See also \Q in page 7.

rindex str, substr [ , offset ]

Returns the position of the last substr in str at or before offset. If the substring is not found, returns –1.

substr expr, offset [ , len [ , newtext ] ]

Extracts a substring of length len starting at offset out of expr and returns it. If offset is negative, counts from the end of the string. If len is negative, leaves that many characters off the end of the string. Replaces the substring with newtext if specified, otherwise, may be assigned to.

uc expr

Returns an uppercase version ...

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

Perl Testing: A Developer's Notebook

Perl Testing: A Developer's Notebook

Ian Langworth, Chromatic
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 9781449311186Errata Page