in reply to Re: writing array element to a file
in thread writing array element to a file

Hi baxy! I did as you suggested in the update, the script run, but the output was empty! I run:
use strict; use warnings; my $infile = "rep_set_ass_tax.fna"; my $outfile = "seq_id.txt"; open(IN, ">>", "rep_set_ass_tax.fna") or die "Died!!"; while (my $line=<IN>) { if($line=~/>(\d+)/) { print $1 . "\n"; } }
What's the problem?
close IN;

Replies are listed 'Best First'.
Re^3: writing array element to a file
by poj (Abbot) on Apr 25, 2013 at 14:16 UTC
    This opens IN for output
    open(IN, ">>", "rep_set_ass_tax.fna") or die "Died!!";
    it should be
    open(IN, "<", "rep_set_ass_tax.fna") or die "Died!!";
    poj