argument_value --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- alay@nkk.com brps@nkk.com, luin@nkk.com sthn@nkk.com toen@nkk.com mara@nkk.com alay@nbkk.com wnrd@nkk.com, jpnd@ckk.com, Daim@nkk.com, nbic@ckk.com, nbrs@crawford.com, nbc1@Ckk.com,jodo@nkk.com, mara@nkk.com trrt@nkk.com alay@nkk.com alam@mkk.com, Case@nkk.com, miob@ikk.com, JTny@ikk.com, RBwn@ikk.com, jsab@ikk.com, Shli@nkk.com, Stee@nkk.com, Eron@nkk.com #### alay@nkk.com, brps@nkk.com, luin@nkk.com, sthn@nkk.com, toen@nkk.com, mara@nkk.com, wnrd@nkk.com, jpnd@ckk.com, Daim@nkk.com, nbic@ckk.com, nbrs@crawford.com, nbc1@Ckk.com, jodo@nkk.com, trrt@nkk.com, Case@nkk.com, miob@ikk.com, JTny@ikk.com, RBwn@ikk.com, jsab@ikk.com, Shli@nkk.com, Stee@nkk.com, Eron@nkk.com #### # Require CPAN module for parsing CSV text files use Text::CSV; package MAIN ; { # Store our CSV file name my $file = '/ppp.csv'; # Obtain a file handle for our CSV file, or die upon failure open (CSV, '<', $file) or die('Unable to open csv file ', $file, "\n"); # Obtain a Text::CSV object my $csv = new Text::CSV; # Loop on the lines in the CSV file foreach my $line () { # If the line parses successfully, print # otherwise, report the failure if ($csv->parse($line)) { # Extract current line's data as an array my @data = $csv->fields(); #print $data[0], "\t", # The name # $data[2], "\n"; # The email address sub remove_duplicates(\@) { my $ar = shift ; my %seen; for ( my $i = 0; $i <= $#{$ar} ; ) { splice @$ar, --$i, 1 if $seen{$ar->[$i++]}++; } } remove_duplicates( @data ); print "@data\n"; } else { print 'Unable to parse CSV line: ', $line, "\n"; } } # Close file handle close(CSV); } 1; __END__