Hi All,
I am a newbie at Perl and am trying to teach myself to become better. I would like to ask for some wisdom.
I have some code and know what it's doing but I can't get my head around how it's actually doing it. I have a fasta file (micro.txt) with several microRNAs in the form of: >hsa-let-7a-5pTGAGGTAGTAGGTTGTATAGTT>hsa-let-7a-3pCTATACAA......etc the code is:
my $micro = 'micro.txt'; open(IN, $micro) or die "Can't open file $micro because $!\n"; while(my $line=<IN>) { if ($line=~/>/) { chomp($line); $line=~s/>//; my $sequence=<IN>; chomp($sequence); } close(IN);
I know that the code is separating the 'header' (i.e.>hsa-let-7a-5p) and 'sequence' part (i.e. TGAGGTAGTAGGTTGTATAGTT) but how is this doing it by just using chomp? My understanding was that chomp just removed any whitespace at the end of a line?? Please help!!
In reply to Not sure how it's working? by theward
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |