#!/usr/bin/perl -w use Text::CSV; my @arrayOfVals; open(my $tmp, "<", "/Users/bioinformatics/Desktop/NC_001903.gbk.txt") || die "Could not open $!"; while (<$tmp>) { chomp; push(@arrayOfVals, $_); } close($tmp); my @arrayFromCSV; open(my $tmpFile, "<", "/Users/bioinformatics/Desktop/cp26_diffexpr.txt") || die "Could not open $!"; while (<$tmpFile>) { chomp; push(@arrayFromCSV, $_); } close($tmpFile); foreach(@arrayFromCSV) { if ($_ eq "BB_B10") { print "MAtch!!\n"; } else {print "$_\n";} } my @wkArray = @arrayOfVals; my @secArrayFromCSV = @arrayFromCSV; while (my $matchCheck = shift @wkArray) { $csvVal = shift(@secArrayFromCSV); if ( $csvVal =~ /$matchCheck/) { my $geneValue = shift(@wkArray); print "$geneValue\n"; } else { print "no match"; } }