in reply to Searching each word of a file

Hi, your code looks like you're not using use strict in your script. I, personally, would be afraid to let anyone play around with gene information without being strict.

update:
other Tips:

* use shift for getting the subroutine's arguments.

* splice(@array, 0, 2) should do the same like shifting the array two times.

* use an array for what you want to return; push new elements to it; return the joined array.

sub parseGeneEntry { my $genesList = shift; my @genes = split /\t/, $genesList; # should be identical with shifting @genes two times; splice( @genes, 0, 2 ); my @return; foreach my $element ( @genes ){ push @return, $element; } return join "\t", @return; }

PS: untested

edit: changed doc links; added 'my' to $genesList;

edit2:
OMG, it can be further shortened (in case you don't want to do anything further in that sub:

sub parseGeneEntry { my $genesList = shift; my @genes = split /\t/, $genesList; # should be identical with shifting @genes two times; splice( @genes, 0, 2 ); return join "\t", @genes; }