in reply to writing to arrays

If I understand the question, you want a separate array for each DATA SET, and each line is one array entry in the proper set.

my @array_set; my $array; while (<DATA>) { if (/^>DATA SET (\d+)) { $array= \$array_set[$1]; } else { push @$array, $_; } }
Something like that; I may have typos and such. How this works is that if a >DATA SET xxx line is seen, then $array is set to point to the proper array. Otherwise, a line is added to the current array.