use strict; use warnings; my %hashOfVals; open(my $tmp, "<", "NC_001903.gbk.txt") || die "Could not open $!"; undef @hashOfVals{map {chomp; $_} <$tmp>}; close($tmp); open(my $tmpFile, "<", "cp26_diffexpr.txt") || die "Could not open $!"; my @arrayFromCSV = <$tmpFile>; chomp @arrayFromCSV; close($tmpFile); for (0..$#arrayFromCSV-1) { print "$1: $arrayFromCSV[$_+1]\n" if $arrayFromCSV[$_] =~ /locus_tag="(.*)"/ and exists $hashOfVals{$1}; }