matth has asked for the wisdom of the Perl Monks concerning the following question:
Why does this bit of code give me problems?
where infile is something like:$infile = "outfile.txt"; open (INFILE, "$infile"); $out_b = "outfile_b.txt"; open (OUT_B, "+>>$out_b"); while(<INFILE>){ print "here\n"; if ($_ =~ /^(.{1,50})\t{0,50}(.{0,50})\t{0,1}(.{0,50})\t{0,1}(.{0, +50})\t{0,1}(.{0,50})\t{0,1}(.{0,50})/){ print "here_B\n"; $gene_id = $1; if ($2 = /.{1,50}/){ (@alternative_ids, $2)}; if ($3 = /.{1,50}/){ (@alternative_ids, $3)}; if ($4 = /.{1,50}/){ (@alternative_ids, $4)}; if ($5 = /.{1,50}/){ (@alternative_ids, $5)}; if ($6 = /.{1,50}/){ (@alternative_ids, $6)}; if ($7 = /.{1,50}/){ (@alternative_ids, $7)}; if ($8 = /.{1,50}/){ (@alternative_ids, $8)}; if ($9 = /.{1,50}/){ (@alternative_ids, $9)}; print @alternative_id; foreach (@alternative_ids){ $alternative_id = $_; print OUT_B "$gene_id\t$alternative_id\n"; } undef @alternative_ids; } }
I get the error message:YAL069W YAL069W Yal069wp YAL068C YAL068C Yal068cp SEO1 YAL067C SEO1 Seo1p YAL066W YAL066W Yal066wp YAL065C YAL064W-B YAL064W-B Yal064w-bp YAL064C-A YAL064C-A Yal064c-ap YAL064W
Modification of a read-only value attempted at extract_notes_B.pl line + 149, <INFILE> line 2.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File handle problems
by PodMaster (Abbot) on Jun 24, 2003 at 10:05 UTC | |
|
Re: File handle problems
by gellyfish (Monsignor) on Jun 24, 2003 at 10:06 UTC | |
|
Re: File handle problems
by broquaint (Abbot) on Jun 24, 2003 at 10:07 UTC | |
|
Re: File handle problems
by Jasper (Chaplain) on Jun 24, 2003 at 11:27 UTC | |
|
Re: File handle problems
by Jasper (Chaplain) on Jun 25, 2003 at 13:51 UTC |