June 2005
Beginner
480 pages
10h 31m
English
Regular expressions are nice for searching scalars for patterns, but sometimes they're overkill. In Perl, some overhead—but not much—is involved with assembling the pattern and then searching for the pattern within scalars. Also, you can easily make mistakes when writing regular expressions. Perl provides several functions for searching and extracting simple information from scalars.
If you merely want to find one string within another scalar, Perl provides the index function. The syntax for index is as follows:
index string, substring index string, substring, start_position
The index function starts at the left of string and searches for substring. The index function returns the position at which substring ...
Read now
Unlock full access