Once you find the SQ line you set the flag, then you accumulate all further lines(without the spaces) into $seq untill you find a line the begins with K and only has spaces or nothing after it. Then you unset the flag.
Dumper is a nice way to printout arrays and hashes for inspection, also works with scalars too
as for your output, it will look something like
Since your sample input doesnt seem to have your sample output values i cant say what the sequence of the print statements should look like. And you may need to adjust $split_after, i didnt feel like countingprint $hash{AC}; print ' | ' print $hash{OS}; print ' | ' print $hash{OX}; print ' | ' print $hash{ID}; print ' | ' print $hash{GN}; print "\n"; my $split_after=50; while (length($seq)>$split_after){ print substr($seq,0,50)."\n"; $seq=substr($seq,$split_after); } print $seq."\n";
In reply to Re^5: Converting Uniprot File to a Fasta File in Perl
by huck
in thread Converting Uniprot File to a Fasta File in Perl
by pearllearner315
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |