my $file = "gene.txt"; open(FH, "< $file") or die "Can't open $file for read"; while(){ push(@array1, $_); } close(FH);