in reply to about separator

Setting the input record separator to "//\n" is a pretty good way to do what you want, but you don't need to muck around changing it in the while loop. In this case "split" is your friend, as in:
while (<INPUT>) { my @lines = split "\n"; # and boom, @lines has each line in your record # ready for your parsing pleasure. .... }

Gary Blackburn
Trained Killer