in reply to Help? - Trouble outputting data corectly

Quick fix: inside the for-each-message loop, reject those that should not be in this section:
next unless $mneighborhood[$b] eq $mneighborhood;
put this at the top of the for loop, before printing anything. It will skip it if the current message's neighborhood is not equal to the value in the outer foreach loop's.

A better approach would be to store things in a list of records rather than in paralell arrays. Then you can grep-out by any criteria you want.

—John