Why does perl read fastq files as all 1s?
So I'm trying to pull some stuff from a fastq file using perl.
#!/usr/bin/perl -w
use strict;
use warnings;
my $open = $pairfile.$j.".fq";
open (FILE, "<$open") or die "\nCouldn't open file $open $!";
while($line = <FILE> && $a<$q){
print $line;
}
Produces an infinite number of '1's. That's it just '1'. What am I doing horribly wrong?
Doing
more FCC5V4BANXX-WHZEBkvtDAAADTAAPEI-100_L7_1.fq
produces the expected
@HISEQ:351:C5V4BANXX:7:1101:1204:2054 1:N:0
NCTGGTAAAGAAACTCGCACACACACACACACACGCACGCACGCACACGCTTACCGAAAACTGTAAGTTTATGAATATTTTTTACACTGTGGCCAATATTTTAGGGAAGTCAGCATCACTAAATG
+
#==ABGGGGGGGGGGGGGGGGGGGGGGGGGDGGGGGGGGGCGEE>GGGGGGGGGGGGGGGGGGFEBFFGGGGF=BFCFGGGGG@FFGGCFGGFFGGG.CEGGGEGG?:DG6BCG5@B=>CG=EBG
• 2,147 views
•
link
1 answer
Try using "and" instead of "&&". The issue is with order of precedence of "=" and "&&".
• 0 views
•
link
Log in to answer this question.
Oh wow. Never mind. The logical test was reporting as true (1), and that was being assigned to $line.
This code will not compile!
Indeed it won't. OP, please provide the real code you used in the future because that will get you a better answer and save people time.