use strict; use warnings; use File::Spec; open(my $fh_in, '<', 'Script\\onkz.txt') or die("open failed: $!"); open(INFILE, '<', 'data.txt') or die("open failed: $!"); my @ONKZ = <$fh_in>; my $filterregex = join('|',@ONKZ); while () { if($_ =~ /^($filterregex)/){ print "$&;$'\n"; } }