#!/usr/bin/perl use strict; use warnings; use Text::CSV_XS; my $file = $ARGV[0] or die "Usage: $0 "; my $csv = Text::CSV_XS->new({binary => 1}) or die "Unable to instantiate CSV object: ", Text::CSV_XS->error_diag(); open(my $fh, '<', $file) or die "Unable to open '$file' for reading: $!\n"; while(my $row = $csv->getline($fh)) { # Do something with $row } #### my %lookup; # The hash that maps "in-house" to "different" and vice versa while (my $in_house_row = $csv->getline($fh)) { my $sample_name = $in_house_row->[0]; next if ! defined $lookup{$sample_name}; }