foreach my $region (@regions) { # something happening in the loop } #### my $region foreach $region (@regions) { # something happening in the loop } #### my $latest_region; foreach my $region (@regions) { $latest_region = $region; # something happening in the loop last if (some condition); } print "last region considered was $latest_region\n";