first of all...unless your filename is always going to be hardcoded, use STDIN during input in the script, and re-direct input from the file or list multiple input files when calling the script,e.g.
perl myscript <file
or
perl myscript file1 file2 file3
perl automagically knows how to feed the script with the input from the file(s)
then the code becomes
my $regex = '(' . join(')|(',@matcharray) . ')';
print "$regex\n";
while(my $line=<>) {
chomp $line;
print "$line\n" if($line=~/$regex/);
}
the hardest line to type correctly is: stty erase ^H