in reply to remove single blank lines?

What I've settle on is shown below. It won't remove a single blank line at the beginning of the file, but I don't need that. It may not be the most efficient way to do this, but it make sense to me. I learned a bunch. Thanks!
#!/usr/bin/perl while (<>) { $last = $this; $this = $next; $next = $_; $lastblank = ($last =~ (/^\s*$/)); $thisblank = ($this =~ (/^\s*$/)); $nextblank = ($next =~ (/^\s*$/)); print $this unless (! $lastblank) && ($thisblank) && (! $nextblank); } print $next unless ($nextblank) && (! $thisblank);