Ok, so your situation is coming into focus finally. It sounds from your description that the three columns are ... unrelated by row? Like this? (PerlMonks just uses HTML for tables)
allcleanfdnc
111111111199999999991111111111
222222222233333333332222222222
3333333333
1010101010
9999999999
8888888888

So, each column is one set of numbers, unrelated by row, and you task is to read the first set, and exclude the other two sets from it?

If so, then your program will look like this:

my (%all, %clean, %fdnc); while (my $row = $csv->getline($input)) { # skip over whatever needs skipped ...; $all{$row->[0]}= 1 if $row->[0]; $clean{$row->[1]}= 1 if $row->[1]; $fdnc{$row->[2]}= 1 if $row->[2]; } for (sort keys %all) { say $_ unless $clean{$_} or $fdnc{$_}; }

But lets talk about that file format some more. Most CSV files have meaning to the rows, where each row is one record, and each column is one attribute of that record. Your file above (if that's really what it looks like and I didn't misunderstand) is really just 3 separate files that happen to be stuffed into columns of one file.

If you use this structure instead, you would have an easier time processing it:
Numberis_cleanis_fdnc
1111111111 1
2222222222 1
33333333331
1010101010
99999999991
8888888888

With a file like this, as you read each row you can immediately know which sets it was part of, and easily add an additional column. It also sets you up nicely to be able to load them into a database, which is where these things generally need to end up for use by web apps and whatever else. So, I'd recommend writing out a new file like this if your system isn't bound to the other format.

If you can't change it and really need that 4th column as an independent set, it gets a little awkward because now you need to iterate 4 sets simultaneously. The code would look like

my @all_nums= sort keys %all; my @clean_nums= sort keys %clean; my @fdnc_nums= sort keys %fdnc; my @dnc_nums= grep !$clean{$_} && !$fdnc{$_}, @all_nums; use List::Util 'max'; my $n= max($#all_nums, $#clean_nums, $#fdnc_nums, $#dnc_nums); for (my $i= 0; i <= $n; $i++) { $csv->print($temp_output, [ $all_nums[$i], $clean_nums[$i], $fdnc_nums[$i], $dnc_nums[$i] ]); }
which seems fairly awkward, which is why I recommend changing the file format.

In reply to Re: Extracting DNC issues by NERDVANA
in thread Extracting DNC issues by MoodyDreams999

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.