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;
- my @grepNames;
- foreach (@compares1)
- {
- if ( grep( /$i/, @compares2 ) )
- {
- print "$compares1[$i]\n";
- }
- $i++;
- }
Add Comment
Please, Sign In to add comment