SECTION, ONE, 1, 4, YELLOW, HIGH, THIS IS COMMENT This is my line This is my page SECTION, THREE, 9, 4, RED, HIGH, THIS IS COMMENT This is a dog This is a cat #### SECTION, ONE, 1, 4, YELLOW, HIGH, THIS IS COMMENT This is a cat This is not a cat SECTION, TWO, 2, 4, BLUE, HIGH, THIS IS COMMENT This is not a book This is a notebook #### SECTION, TWO, 2, 4, BLUE, HIGH, THIS IS COMMENT #### SECTION, TWO, 2, 4, BLUE, HIGH, THIS IS COMMENT This is not a book This is a notebook #### #!/bin/perl -w use strict; use warnings; use File::Copy; use Cwd; my $dir = cwd; main(); sub main { printf "\nStarting script\n"; printf "\nEnter the file 1: "; my $fh1 = ; chomp $fh1; printf "\n"; printf "Enter the file 2: "; my $fh2 = ; chomp $fh2; my $tempFile = "temp.txt"; my $nonMatch = "nonMatch.txt"; if(-e $fh1 and -e $fh2) { my %results = (); open (FILE1, "<$fh1") or die "Input file $fh1 not found.\n"; while(my $line = < FILE1>) { if($line =~ /^Section/) { my ($sec, $first, $second, $third, $color, $mode, $description_comments) = split(',', $line, 7); $results{$line}=1; } } close(FILE1); open (FILE, "<$fh2") or die "Input file $fh2 not found.\n"; while(my $line = <>) { if($line =~ /^Section/) { my ($sec, $first, $second, $third, $color, $mode, $description_comments) = split(',', $line, 7); $results{$line}++; } } close(FILE2); open (NONMATCH, ">$nonMatch") or die "Cannot open $nonMatch for writing \n"; foreach my $line (keys %results) { print NONMATCH " $results{$line} - $line" if $results{$line} ==2; } close NONMATCH; } close FILE2; }