Using foreach to loop through array variable
#!/usr/bin/perl -w use strict; my @array = qw(A B C D); my $element; foreach $element (@array) { print $element, "\n"; }