Dec 3, 2013, 3:14 PM
Post #1 of 6
Finding a string from one file into another file
I need help in searching for a string from one file into another file and printing it.I have two files "id.txt" and "path.txt".
id.txt has values as below
and path.txt has values as below
Now here I want to find all the values from file path.txt which would start with the value from id.txt
Here is my program as below. But would print only one line and not iterating through the complete file.
open DFH,'<',"D:\\perlprog\\id.txt" or die "Could not open file";
open VFH,'<',"D:\\perlprog\\path.txt" or die "Could not open file";
foreach (my $da=<DFH>)
print $_ if(/$da/);
Could you please help me solve this issue.
Apologize if commiting any mistake as I am beginner.