Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use warnings;
- use strict;
- my @compares1;
- my @compares2;
- open(FILE, "file1.txt") or die("Unable to open file");
- while(<FILE>)
- {
- chomp;
- my @spaces = split(/ /);
- #print $spaces[0] . "\n";
- push @compares1, $spaces[0];
- }
- close(FILE);
- open(F, "file2.txt") or die("Unable to open file");
- while(<F>)
- {
- chomp;
- my @next = split (/ /);
- #print $next[0] . "\n";
- push @compares2, $next[0];
- }
- close(F);
- #print "@compares1\n";
- #print "@compares2\n";
- my $i = 0;
- my $status = 0;
- foreach (@compares1)
- {
- #print "$_\n";
- #print @compares2;
- #print "1: $compares1[$i]\n";
- #print "2: $compares2[$i]\n";
- if ($compares1[$i] ne $compares2[$i])
- {
- $status = 1;
- last;
- }
- $i++;
- }
- print $status?"Nie OK\n":"OK\n";
Add Comment
Please, Sign In to add comment