I do not see that error; what is the exact code you have?
sub find_string {
my ($file, @strings) = @_;
open my $fh, '<', $file;
while (<$fh>) {
for my $string (@strings) {
return 1 if /\Q$string/;
}
}
die "Unable to find string: @strings";
}
find_string('filename', "testing","link","rd");
Of course the above should be amended to test that the open worked:
open my $fh, '<', $file or die "File open fail ($file): $!";
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|