# floor1.txt # This files contains info about floor 1. # floor2.txt # This files contains info about floor 2. # floor3.txt # This files contains info about floor 3. use strict; use warnings; my @buildings = qw(building1 building2); my @floors = qw(floor1 floor2 floor3); my $current_building; my $floorfile; foreach (@buildings) { $current_building = $_; print "$current_building\n\n"; foreach (@floors) { $floorfile = $_ . ".txt"; print "$_\n"; # Why does the while loop, below, mess up the 2nd iteration of the foreach? # open FLOORFILE, $floorfile or die $!; # while () # { # print "$_\n"; # } } print "\n\n"; }