in reply to Getting Rid of Newlines Between Strings

You are skipping lines that contain NA. You can skip the empty lines in the same way, just change line 12 to
if ($cg =~ /^$|NA/) {

It tells Perl to skip the line if it starts (^) and ends ($) immediately, or (|) contains NA.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Getting Rid of Newlines Between Strings
by marinersk (Priest) on Aug 13, 2013 at 06:39 UTC
    Just a thought; to cover the possibility of a humanly blank line which happens to contain whitespace, it could be further modified:
    if ($cg =~ /^\s*$|NA/) {
Re^2: Getting Rid of Newlines Between Strings
by ccelt09 (Sexton) on Aug 13, 2013 at 00:00 UTC

    This worked perfectly, many thanks for the help. Smooth sailing ahead for the rest of the afternoon!