> if ($result eq $file1) This is checking to see if each line matches the filename itself, not the contents of file1. You were going for the contents of $file1, correct?
Here's my stab. Read in the target files first, then match. When it walks through the source file, it will print out the name of all target files that match. my $sourcefile='source'; my @targetfiles=('one', 'two', 'three'); my %dest; foreach my $file (@targetfiles) { open INFILE, $file or die "Can't open $file: $!\n"; while (<INFILE>) { chomp; (defined $dest{$_}) ? ($dest{$_}=$dest{$_}.", $file") : ($dest{$_}=$file); } close INFILE; } open INFILE, $sourcefile or die "Can't open $sourcefile: $!\n"; while (<INFILE>) { chomp; print "$_ was found in $dest{$_}\n" if (exists $dest{$_}); } close INFILE; On Tue, 21 Jan 2003, Marco wrote: > 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)? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]