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.
In reply to File handle problems by matth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |