#!/usr/bin/perl -w $text = <$_

\n}, split /\n{2,}/, $text; print $text;