#!/usr/bin/perl local $/; open my $fh, '<', 'C:/Users/bwinkley/Desktop/test/whitespace.txt' or die $!; my $txt = <$fh>; #$txt =~ s/(\n\|)/ /mg; $txt =~ s/\R\|/ /mg; for ( split '\n', $txt ) { # process each line } print $txt;