my $rx_empty = qr{ \A \s* \z }xms; # empty line (or whitespace only) #### if ($record =~ $rx_empty) { # ignore next RECORD }