Thank you both for your response. Graff, your tool is indeed very helpful for a lot of what we do. For this solution though, Grandfather's solution does seem a bit more relevant and as I am somewhat under time constraints to complete this script, it seemed more logical as I can add on to my existing code.
I've made some slight changes to the code above ...but after spending numerous hours debugging the script, I still can't seem to get it work properly. I maybe missing some logic here...but when I run the script, it seems to output everything into nc_load.txt

Here's the code:
#!/usr/bin/perl -w $excludeaccts = "accts_to_exclude.txt"; open(EXCLUDELIST, $excludeaccts) || die ("Cannot open $excludeaccts"); #Load accounts-to-exclude into a hash table %exclusionlist = map {chomp; $_ => undef} <EXCLUDELIST>; close(EXCLUDELIST); $ncaccts = "nc_acct_list.txt"; open(NCLIST, $ncaccts) || die ("Cannot open $ncaccts"); %ncacctlist = map {chomp; $_ => undef} <NCLIST>; close(NCLIST); $ccaccts = "cc_acct_list.txt"; open(CCLIST, $ccaccts) || die ("Cannot open $ccaccts"); %ccacctlist = map {chomp; $_ => undef} <CCLIST>; close(CCLIST); $ccnames = "cc_name_list.txt"; open(CCNALIST, $ccnames) || die ("Cannot open $ccnames"); %ccnamelist = map {chomp; $_ => undef} <CCNALIST>; close(CCNALIST); $origaccts = "orig_accts_list.out"; open(ORIGACCTLIST, $origaccts) || die ("Cannot open $origaccts"); open($output, '>', 'output.txt' || die "Cannot open output file output +.txt"); open($ncoutput, '>','nc_load.txt' || "Cannot open output file nc_load. +txt"); open($ccoutput, '>', 'cc_load.txt' || "Cannot open output file cc_load +.txt"); while ($line = <ORIGACCTLIST>){ chomp $line; ($filename, $state, $amt, $ttl, $account, $name, $invnum) = split /\t/ +, $line; next if exists $exclusionlist{$account}; print $output "$filename\t$state\t$amt\t$ttl\t$account\t$name\t$invnum +\n"; if (defined $ncacctlist{$account}) { print $ncoutput "$filename\n"; next; } if (defined $ccacctlist{$account}) { print $ccoutput "$filename\n"; next; } if (defined $ccnamelist{$name}) { print $ccoutput "$filename\n"; last; } print $ncoutput "$filename\n"; ###(I added the above line such that anything that's not in $nccctlist +, $ccacctlist, $ccnamelist will be printed to nc_load.txt file If I r +un it without this line, nothing is being printed to nc_load.txt or c +c_load.txt)### }

Any suggestions as to what I maybe doing wrong here? Thanks.

In reply to Re^2: comparing lists by Anonymous Monk
in thread comparing lists by Anonymous Monk

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.