The foreach statement iterates through list values, assigning a variable the value of each element in turn.
#!/usr/local/bin/perl
# Create a list of the days of the week.
@days = qw (Monday Tuesday Wednesday Thursday Friday Saturday Sunday);
# Cycle through the loop, and print out the contents.
foreach $day (@days)
{
print "$day\n";
}