foreach my $file (@homes) { open(HOUSE, "<$base_directory/homes/$file") || die &show_error("Unable to open file in sort routine"); @home = ; close(HOUSE); # create array of arrays chomp(@home); push @sorted, \@home; }