Perl Language Lists Array as list


The array is one of Perl's basic variable types. It contains a list, which is an ordered sequence of zero or more scalars. The array is the variable holding (and providing access to) the list data, as is documented in perldata.

You can assign a list to an array:

my @foo = ( 4, 5, 6 );

You can use an array wherever a list is expected:

join '-', ( 4, 5, 6 );
join '-', @foo;

Some operators only work with arrays since they mutate the list an array contains:

shift @array;
unshift @array, ( 1, 2, 3 );
pop @array;
push @array, ( 7, 8, 9 );