#!/usr/local/bin/perl

#######################################################################
# Showing the pattern match to the contents of the first file of the
# contents of the second file.
# Usage: ./compare_number.pl compare_file object_file

open(NUMBER, $ARGV[0]) || die "Can't open $ARGV[0]: $!\n";

$_ = <NUMBER>;
/(.*)$/;
$compare = $1;

while ($_ = <NUMBER>) {
  /(.*)$/;
  $input = $1;
  $compare = $compare . "|" . $input;
}

open(CONTENT, $ARGV[1]) || die "Can't open $ARGV[1]: $!\n";

print "Matching list(", $compare, "):", "\n";

while ($_ = <CONTENT>) {
  if (/$compare/) {
    print;
  }
}
