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"); #### open my $fh, '<', $file or die "File open fail ($file): $!";