Vladi Belperchinov-Shabanski wrote:

> #!/usr/bin/perl -p
> $_='' if !/\S/ && $e;   # i.e. don't print if empty and last one was empty
> $e = !/\S/;             # remember if last one is empty...
> #eof

Reading in a paragraph at a time rather than a line at a time helps
here.  Perl's idea of a paragraph is some text ending in at least one
empty line (or EOF), but it helpfully treats consecutive empty lines as
being a single empty line.

So this seems to be good enough:

#! /usr/bin/perl -00p
__END__

Smylers

Reply via email to