Hi,
I'm new to perl and i have to write a perl script that will compare to log/txt files and display the differences. Unfortunately I'm not allowed to use any complied binaries or applications like diff or comm.
So far i've across a code like this:
use strict;
use warnings;
my $list1;
my $list2;
my @list1 = qw(111 222 333);
my @list2 = qw(222 333 444);
LIST2: foreach $list2 (@list2){
LIST1: foreach $list1 (@list1){
if ("$list2" eq "$list1") {
next LIST2;
}
}
print "$list2 \n";
}
When I run this I get 444 returned as expected. However I'm wondering how I can change this so that it compares two log or txt files (ie. list1.txt and list2.txt).
Any help at all would be great.
Thanks in advanced.