Your for (<DATA>) would be better written as while (<DATA>). Using for will have the effect of reading the entire file into memory rather than processing a line at a time as with while. Not a problem, perhaps, with small data sets but it's not a good habit to get into.
Cheers,
JohnGG
Comment on Re^2: How to extract lines starting with new names/words