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

Defining and Using Lists and Arrays

The care and feeding of the wily Perl array includes defining it, assigning it to an array variable, sticking elements in and taking them out, and finding out its length (the number of elements). There are also a whole lot of things you can do to manipulate arrays and their data, but let's start with the basics.

Unlike other languages, in which arrays have to be carefully set up before you can use them, arrays in Perl magically appear as you need them and happily grow and shrink to the number of elements you have in them at any given time. They can also contain any kind of scalar data: numbers, strings, or a mix of both, and as many elements as you want, limited only by the amount of memory you have available. ...

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