Section B.10. Lists and Arrays


B.10. Lists and Arrays

Perl has a number of features that make it easy to manipulate an entire list or array.

B.10.1. map and grep

In Chapter 16, we mentioned the map and grep list-processing operators. They can do more than we could include here. See the perlfunc manpage for more information and examples, and check out the Alpaca for more ways to use map and grep.

B.10.2. The splice Operator

With the splice operator, you can add items to the middle of an array or remove them, letting the array grow or shrink as needed. (Roughly, this is like what substr lets you do with strings.) This effectively eliminates the need for linked lists in Perl. See the perlfunc manpage.



Learning Perl
Learning Perl, 5th Edition
ISBN: 0596520107
EAN: 2147483647
Year: 2003
Pages: 232

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net