in reply to Re: File Compare
in thread File Compare
Hi Nikhil. I tried with this below snippet but this is not getting into the if loop at all.
open(TMPL, '<', "HTML.txt") or die $!; %dump = $resp->content; print TMPL %dump; while (<TMPL>) { $dump{$_} = $_; } close(TMPL); open FILE, "> new_HTML.txt" or die $!; open FILE2, "< Users.txt" or die $!; while(<FILE2>) { if(defined($sp_dump{$_})) { print FILE $sp_dump{$_}; } else { print"Line not match"; } } close(FILE2); close(FILE);
Here * HTML.txt is the text file with HTML content from a URL * Users.txt contains some users data * new_HTML.txt is where i need only User specific data (from Users.txt) in the same format as HTML.txt I need the whole content in new_HTML.txt to be as it is in HTML.txt BUT only for those Users in the Users.txt Am doing the right stuff here?
|
|---|