# what is in $test ? Not specified. my $string = quotemeta("$test"); foreach my $filename (@daten){ print "finding -$string- in $filename\n"."
"; open(my $file, "<", $filename) or die "Can't open the file: $!"; while (<$file>) { if (/$string/) { print; # NEW STATEMENT my ($content) = m/(\/$string\/[a-z]*)/g; # different match, might fail print $content; print "found string -$string- in line $. \n"; # $. is the line number print "
"; } } }