#!/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} ; close(EXCLUDELIST); $ncaccts = "nc_acct_list.txt"; open(NCLIST, $ncaccts) || die ("Cannot open $ncaccts"); %ncacctlist = map {chomp; $_ => undef} ; close(NCLIST); $ccaccts = "cc_acct_list.txt"; open(CCLIST, $ccaccts) || die ("Cannot open $ccaccts"); %ccacctlist = map {chomp; $_ => undef} ; close(CCLIST); $ccnames = "cc_name_list.txt"; open(CCNALIST, $ccnames) || die ("Cannot open $ccnames"); %ccnamelist = map {chomp; $_ => undef} ; 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 = ){ 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 run it without this line, nothing is being printed to nc_load.txt or cc_load.txt)### }