What I'm trying to achieve is the following: I have an ASCII text file (zonelist.input) for input which contains a domainname (that is i.e. foo.com) on each line ( a total of about 230 lines are in this file). Furthermore, I have 3 other text files. I'm looking for a method to read each line from the input file and search for each string against the 3 other files and have the program tell me in which of the 3 files the string from the input file was found. Would this be hard to achieve (I'm looking for some code)?
Sofar, I've tried the following code:
#!/usr/bin/perl -w
use strict;
my ($file1, $file2, $file3) = ('boot.fixed', 'boot.wise', 'boot.dynamic.new');
my @input = `cat /data0/store/mars/pri/mars/named/zonelist.input`;
foreach my $result (@input) {
if ($result eq $file1) {
print "$result was found in $file1";
} elsif ($result eq $file2) {
print "$result was found in $file2";
} elsif ($result eq $file3) {
print "$result was found in $file3";
} else {
print "$result was not found in any file!\n";
}
}
This only prints each line of the input file with the final print statement appended
to it.
TIA
Gr,
--
Marco van Lienen <[EMAIL PROTECTED]>
GPG:0x8580E6CB Available on keyservers.
We are BitchX of Borg. You will be assimilated. Using mIRC is futile
S@H:6551WU/11.052yr --> setiathome.ssl.berkeley.edu Put those CPU cycles to use!
Why did it happen ? BOFH Excuse:
Fatal error #6 occurred while trying to report error 6.
msg37029/pgp00000.pgp
Description: PGP signature
