I am a perl beginner and am trying to write a script to remove single blank lines from text files, but leave any two or more consecutive blank lines alone. What I have done is shown below, but that will remove 1 blank line from any one or more consequtive blank lines (not quite what I need):
#!/usr/bin/perl
while (<>) {
print unless ($_ eq "\n") && ($_ ne $last);
$last = $_;
}