xabcd a1 +b1 +b2 +b3 +b4 +b5 abcd xcdef c1 +d1 +d2 +d3 +d4 +cdef #### xabcd a1b1b2b3b4b5 abcd xcdef c1d1d2d3d4cdef #### #!/usr/bin/perl use warnings; use strict; use diagnostics; open my $fh, "<", "$ARGV[0]" or die "Could not open $!"; my @file = <$fh>; $/ = "\n+"; chomp (@file); print "@file\n";