sample of input file: M12345678 John Doe 11/20/15 M987654 REJECTED FAILED --------------------------------------------- sample of output file: M12345678 John Doe 11/20/15 M987654 REJECTED FAILED use strict; my $find = '^M'; open (NEW, ">", "output.txt" ) or die "could not open:$!"; open (FILE, "<", "Report.txt") or die "could not open:$!"; while () { print NEW if (/$find/); } close (FILE); close (NEW);