There is a lot of repetition, most of the if blocks do the same thing and each block repeats its list of headers. And that list of headers it's pretty hard to read. I'd suggest that you look at factoring out much of that duplication. Something like

my %inputfiles = ( gene2accession => join( "\t", qw( Taxon GeneID Status RNA_Nucleotide_Accession RNA_Nucleotide_gi Protein_Accession Protein_gi Genomic_Nucleotide_Accession Genomic_Nucleotide_gi Genomic_Accession_Start_Pos Genomic_Accession_End_Pos Orientation Assembly ) ), gene2go => join( "\t", qw( Taxon GeneID GO_ID Evidence Qualifier GO_term PubMedID Category ) ), ... ); foreach my $file ( keys %inputfiles ) { ... while ( my $line = <INPUT> ) { if ( $linecount == 0 ) { print OUTFILE "$file\n"; print SUMMARY "Field lengths for file $file\n"; print SUMMARY "$inputfiles{$file}\n"; if ( $file eq 'hiv_interactions' ) { # do special processing } } } ... }
seems to be easier to read. It is obvious that the header is the same in both the summary and out files and that hiv_interactions gets special treatment. The headers are also easier to read. At least something to consider for your next script;)


In reply to Re: Can't write to open writeable Filehandle by hipowls
in thread Can't write to open writeable Filehandle by Ellhar

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.