in reply to compare two files line by line and perform a diff on each coressponding line
If you only want to compare each line of tst1 to the corresponding line in tst2 you don't need two loops. Use something like this:
while (@tst1) { $i= shift @tst1; $j= shift @tst2; chomp($i); chomp($j); `diff $i $j > /dev/null`; `echo $?`; }
You thought you needed two loops because you wanted to step through two arrays, but you need only one loop that makes a simultaneous step through both arrays.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: compare two files line by line and perform a diff on each coressponding line
by dilip_val (Acolyte) on Jun 01, 2010 at 15:33 UTC |