Note kennethk's comments regarding the two parameter open in his reply to the OP!

What kennethk forgot to mention was that you should use lexical file handles too.

open ... $filename || die makes for an unhappy life. || binds to $filename, not to the result of open as you may be hoping. $filename is true for all likely values so the die will never fire, regardless of what the result of the open is! Use open ... $filename or die instead. It's often helpful in the die to show the error message associated with the open failure using $OS_ERROR ($!).

Making those changes, removing extraneous () and minor adjusting of white space produces the following (untested) code:

#!/usr/bin/perl use strict; use warnings; die "Usage fileReference File2Check >outfile" if @ARGV != 2; my ($fileRef, $file2Check) = @ARGV; open my $fileREFIn, '<', $fileRef or die "unable to open $fileRef: $!" +; open my $fileCHKIn, '<', $file2Check or die "unable to open $file2Chec +k: $!"; my %seen = map { chomp; $_ => 1 } <$fileREFIn>; print grep {! $seen{(split /,/, $_)[0]}} <$fileCHKIn>;

True laziness is hard work

In reply to Re^2: list lines not found in config (while+if) by GrandFather
in thread list lines not found in config (while+if) by tangledupinperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.