use strict; use warnings; find_string { my ($file, @strings) = @_; open my $fh, '<', $file; my $re = join "|", map quotemeta, @strings; while (<$fh>) { return 1 if /$re/; } die "Unable to find string: $string"; } find_string('prepos.config', "testing","link","100K");