foreach my $person (@people) { ## ... ## Long and complex code that uses $person many times, might ## potentially be refactored into nested loops in the future, etc. ## ... } #### say $_->{name} foreach @people; #### $age_sum += $_->{age} foreach @people;