Hi Monks!
So, I have a file like the followind:
236 28KD_MYCLE Train MPNRRRCKLSTAISTVATLAIASPCAYFLVYEPTASAKPAAKHYEFKQAASIADLPGEVLDAISQGLSQF +GINLPPVPSL TGTDDPGNGLRTPGLTSPDLTNQELGTPVLTAPGTGLTPPVTGSPICTAPDLNLGGTCPSEVPITTPISL +DPGTDGTYPI LGDPSTLGGTSPISTSSGELVNDLLKVANQLGASQVMDLIKGVVMPAVMQGVQNGNVAGDLSGSVTPAAI +SLIPVT SSSSSSSSSSSSSSSSSSSSSS................................................ +.......... ...................................................................... +.......... ...................................................................... +...... // 338 A85A_MYCTU Train MQLVDRVRGAVTGMSRRLVVGAVGAALVSGLVGAVGGTATAGAFSRPGLPVEYLQVPSPSMGRDIKVQFQ +SGGANSPALY LLDGLRAQDDFSGWDINTPAFEWYDQSGLSVVMPVGGQSSFYSDWYQPACGKAGCQTYKWETFLTSELPG +WLQANRHVKP TGSAVVGLSMAASSALTLAIYHPQQFVYAGAMSGLLDPSQAMGPTLIGLAMGDAGGYKASDMWGPKEDPA +WQRNDPLLNV GKLIANNTRVWVYCGNGKPSDLGGNNLPAKFLEGFVRTSNIKFQDAYNAGGGHNGVFDFPDSGTHSWEYW +GAQLNAMKPD LQRALGATPNTGPAPQGA SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS............................ +.......... ...................................................................... +.......... ...................................................................... +.......... ...................................................................... +.......... .................. // 325 A85B_MYCBO MTDVSRKIRAWGRRLMIGTAAAVVLPGLVGLAGGAATAGAFSRPGLPVEYLQVPSPSMGRDIKVQFQSGG +NNSPAVYLLD GLRAQDDYNGWDINTPAFEWYYQSGLSIVMPVGGQSSFYSDWYSPACGKAGCQTYKWETFLTSELPQWLS +ANRAVKPTGS AAIGLSMAGSSAMILAAYHPQQFIYAGSLSALLDPSQGMGPSLIGLAMGDAGGYKAADMWGPSSDPAWER +NDPTQQIPKL VANNTRLWVYCGNGTPNELGGANIPAEFLENFVRSSNLKFQDAYNAAGGHNAVFNFPPNGTHSWEYWGAQ +LNAMKGDLQS SLGAG SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.............................. +.......... ...................................................................... +.......... ...................................................................... +.......... ...................................................................... +.......... ..... // 325 A85B_MYCKA MTDVSGKIRAWGRRLLVGAAAAAALPGLVGLAGGAATAGAFSRPGLPVEYLQVPSAAMGRSIKVQFQSGG +DNSPAVYLLD GLRAQDDYNGWDINTPAFEWYYQSGLSVIMPVGGQSSFYSDWYSPACGKAGCTTYKWETFLTSELPQWLS +ANRSVKPTGS AAVGISMAGSSALILSVYHPQQFIYAGSLSALMDPSQGMGPSLIGLAMGDAGGYKASDMWGPSSDPAWQR +NDPSLHIPEL VANNTRLWIYCGNGTPSELGGANVPAEFLENFVRSSNLKFQDAYNAAGGHNAVFNLDANGTHSWEYWGAQ +LNAMKGDLQA SLGAR SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.............................. +.......... ...................................................................... +.......... ...................................................................... +.......... ...................................................................... +.......... ..... //

and what I want is to print the line with the ID (namely the one that starts with a number), and then, 2 lines, one that will have the sequence of letters and another one that will have the SSSSSSSSSSS....... sequence.
For some reason the code that I have tried does not print anything.
$/="//\n"; while(<>) { if($_=~/^(\d+)\s+(.*)/m) {$seq_length=$1; $ID=$2;} $seq=''; while($_!~/([A_z]+)/mg) { $part1=$1; $seq.=$seq.$part1; } $top=''; while($_=~/([S\.]+)/mg) {$part2=$1; $top.=$top.$part2;} print ">$ID\n$seq\n$top\n"; } $/="\n";

In reply to create an one-line format for this by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.