in reply to Question on anon hashes

You've got to save each school in a different place. One way is to use a data index, like this:

$school_number = -1; # no schools yet ... foreach my $line1(@x){ $school_number++; # change the data index ($school[$school_number]{school}, $school[$school_number]{addr}, ...