Create an Array, loop over with foreach



examples/perlarrays/list_colors_array.pl
#!/usr/bin/perl
use strict;
use warnings;

my @colors = ("Blue", "Yellow", "Brown", "White");
print "@colors\n";

foreach my $color (@colors) {
    print "$color\n";
}

Blue Yellow Brown White
Blue
Yellow
Brown
White

Perl for loop explained with examples