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; }

In reply to Re: Searching each word of a file by linuxer
in thread Searching each word of a file by biomonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.