#!/usr/bin/perl open(IN, "data.out") or die ("outFile not found -- $!\n"); while() { local $/=''; my $cnt=0; while(//){ s!!''!ie; } print OUT; } close(IN); close(OUT);