in reply to
Remove blank lines from REGEX output
FYI, if you only want such a loop to consider certain lines within the file, a rather handy “Perl-ism” would be a line that looks like this:
next unless $data_line =~ ...whatever... ;
... followed by whatever else you might need in the loop. The loop will immediately proceed to the next line, unless the line matches the particular condition, and thus you avoid having to write a rather large and bulky if-statement that encompasses the rest of the while block. Plus, it reads easily ... it’s a very human-natural way of saying it.