use File::Glob; my @files = glob("C:/Wire/*.csv"); foreach my $x (@files) { open FILE, $x; while () { my @temp = split(/,/, $_); next if (substr($_,0,5) =~ /Debit/) ; print $_;} }