while ($texto = ) { $texto =~ s/\n\n+/\n/g; print "$texto"; print DOS "$texto\n"; }