Hello,
I have two text files and have extracted each to its own array. I want to compare these two arrays to each other, line by line, and print the lines in file2 that are not in file1. Here is my code so far:
use strict; use warnings; my @lines; my @lines2; my $line; my $line2; open (OF, "> diff3.txt"); open (F2, "20100331.txt"); open (F, "20100316.txt"); while (<F>) { @lines=(<F>); } close (F); while (<F2>) { @lines2 = (<F2>); } close (F2); foreach $line (@lines) { foreach $line2 (@lines2) { print OF $line2 if ($line2 ne $line +)} $line=""; $line2=""; } close (OF);
Thanks in advance!!
In reply to Comparing Two arrays to find differences by JonDepp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |