O'Reilly logo

Sams Teach Yourself Perl in 21 Days, Second Edition by Rafe Colburn, Laura Lemay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Manipulating Strings

In the bulk of this lesson, we've explored ways you can manipulate lists and list contents with various built-in functions. Perl also has several useful functions for manipulating strings as well (and I summarized a number of these on Day 2). In this section, let's cover a few of these functions, including reverse, index, rindex, and substr.

Each of these functions is used to modify strings. In many cases, it might be easier or more efficient to modify strings using other mechanisms—concatenating them using the . operator, building them with variable values using variable interpolation, or searching and extracting substrings with patterns (as you'll learn in the next few days). But in many cases, these functions might be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required