in reply to How do I compare two strings against two arrays respectively?
The question title itself is referring to arrays, in which case the other responses would be more appropriate, but the question itself has to do with file contents, so I thought I'd throw this out there.sub check_file { my $filename = shift; my $string = shift; open(F, "< $filename") or die "$filename: $!"; while(<F>) { close(F), return 1 if /\Q$string\E/; } close(F); return } if (search_file('file1', 'string1') && search_file('file2', 'string2')) { print "OK\n"; } else { print "No\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Answer: HOw do I compare two strings against to arrays respectively
by Fastolfe (Vicar) on Nov 04, 2000 at 01:28 UTC |