Array Manipulation

Unlike the arrays in many popular programming languages, Perl arrays are not of fixed length. This makes it simple to expand or contract an array in Perl. Many array functions are provided in Perl to operate on arrays in various ways. The first group of functions allows you to dynamically change the size of an array.

Functions that Alter the Size of an Array

Perhaps the most important functions used by Perl programmers are those that allow Perl arrays to grow or shrink. This section demonstrates many of these Perl functions.


The split function takes a scalar variable and returns an array. The array is composed of the fields of the scalar delimited by whatever characters you specify. In its simplest case, split splits ...

Get Programming PERL in the .NET Environment now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.