#!/usr/bin/perl while(<>) { $BLANK=/^\s*$/; if($BLANK && !$WASBLANK or not $WAS{$_}) { print; $WAS{$_}=1 }; $WASBLANK=$BLANK; }