The line breaks are intentional to make the final file more readable when I format it. What does using the {parameter?} "my $line" before the (@array) do? And, let's see if I have any idea what's going on, the second line skips a line if it starts with a #?