#!/usr/bin/perl use strict; use warnings; local $/ = "\n\n"; my @blocks = ; $_ =~ s/\n//g for @blocks; print join "::", @blocks; __DATA__ abc abc abc def def