in reply to Re^2: Creating 2 arrays from a larger array
in thread Creating 2 arrays from a larger array
You are in a loop, so $dnaString is being added to everytime the line doesn't match your start pattern. $dnaString is always one step behind @seqList so when you come to the next start line, it pushes the previous $dnaString onto @sequences, then clears it for the next iteration. Best thing to do is try it: set $count = 1 and see what happens.
Update: after re-reading this I'm a bit confused myself. Better to put a print statement within the loop:
Update: after re-reading this I'm a bit confused myself. Better to put a print statement within the loop:
my $dnaString = ''; ... if ($line=~/^>(\S+)/){ print qq|Count: $count, Match: $1, String: $dnaString\n|; push (@seqList, $1);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Creating 2 arrays from a larger array
by imtakinbioinformatic (Initiate) on Mar 08, 2012 at 04:08 UTC | |
by NetWallah (Canon) on Mar 08, 2012 at 06:15 UTC | |
by tangent (Parson) on Mar 08, 2012 at 13:54 UTC | |
by imtakinbioinformatic (Initiate) on Mar 08, 2012 at 14:59 UTC | |
Re^4: Creating 2 arrays from a larger array
by imtakinbioinformatic (Initiate) on Mar 08, 2012 at 14:52 UTC |
In Section
Seekers of Perl Wisdom