use -0 to read whole file at once:
cat foo.txt | perl -p0 -e 's/-----\n\n-----/------/g' [download]
In reply to Re^3: Two line match by grizzley in thread Two line match by jrosenfeld