Hi, during some tests, i found that file comparing, line by line is slow, probably i didn't do it right too.
So what i'm looking for are best ways to do that.
I wanted to check if values from file2.txt are in file1.txt and if they exist (Ignore case), report to stdout.
EDIT: Resolved.Code:open( WORDS1, "words01.txt"); open( WORDS2, "words02.txt"); @allwords1=<WORDS1>; @allwords2=<WORDS2>; foreach(@allwords1){ chomp($myword=$_); foreach(@allwords2){ chomp($myword2=$_); if($myword1 =~ /$myword2/i){ print $myword1, "was found on both files!\n"; } } }




and rating it.
Reply With Quote