
| Contents |
|||||||||||||||
| [an error occurred while processing this directive] |
3.4.4 Array InterpolationArray variables can also be evaluated through interpolation into a double-quoted string. This works very much like the interpolation of scalars into double-quoted strings (see section 2.3.1 Scalar Interpolation). When an array variable is encountered in a double-quoted string, Perl will join the array together, separating each element by spaces. Here is an example:
use strict; my @saying = qw/these are a few of my favorite/; my $statement = "@saying things.\n"; # $statement is "these are a few of my favorite things.\n" my $stuff = "@saying[0 .. 1] @saying[$#saying - 1, $#saying] things.\n" # $stuff is "these are my favorite things.\n"
Note the use of slices when assigning |