in reply to use of uninitialized value in array

I thought I'd provide another solution. It uses a hash, %seen, to serve as a lookup for genes in 'HFR_genes.txt' that are also in 'gene_list.txt'.
#!/usr/bin/perl use 5.010; use strict; use warnings; my $gene_list = 'gene_list.txt'; open GL, "<", $gene_list or die "Unable to open $gene_list because $!" +; my %seen; while (my $gene = <GL>) { $seen{$gene}++; } close GL or die "Unable to close $gene_list because $!"; my $hfr = 'HFR_genes.txt'; open HFR, "<", $hfr or die "Unable to open $hfr because $!"; while (my $gene = <HFR>) { print if $seen{$gene}; } close HFR or die "Unable to close $hfr because $!";
Chris

Update: If both files have unique lines, the code could be shortened to:

my %seen; print grep $seen{$_}++, <>;
With the command line supplying the 2 files: perl your_program.pl gene_list.txt HFR_genes.txt