for, foreach, while.
Goal
Say each city and a running total.
use strict;
use warnings;
use feature 'say';
foreach my $city ("Nairobi", "Mombasa", "Kisumu") {
say $city;
}use strict;
use warnings;
use feature 'say';
my $total = 0;
for (my $i = 1; $i <= 5; $i++) {
$total += $i;
say "$i $total";
}use strict;
use warnings;
use feature 'say';
my @units = (12, 8, 5);
my $i = 0;
while ($i < @units) {
say $units[$i];
$i += 1;
}use strict;
use warnings;
use feature 'say';
foreach my $city ("Nairobi", "Nakuru", "Eldoret") {
last if $city eq "Nakuru";
say $city;
}