#open the textfile GeneType.txt open (GENETYPE, "GeneType.txt") or die "Could not open file"; while (){ ($GeneName, $GeneType)= split (/\t/, $_); $GeneHash{$GeneName} = $GeneType; #create hash my $scalar = delete $GeneHash{GeneName}; #removes the first line which is a header print (each %GeneHash); #printing out the has just as a check