I am not sure what all you want to keep, but your regex seems a little extreme for the example you show. Here is how I would solve it. I give it a little bit of formatting that I hope doesn't confuse the issue.
while (<DATA>) { # the regex remembers for one or more # alphanumeric characters \w+ # followed by an equal sign and double quote # then remembers one or more digit or comma [\d\,]+ # follwed by a double quote. if (/(\w+)\=\"([\d\,]+)\"/) { # The print statement adds an equal amount # of padding between the first entry and the # second by subtracting the length of $1 by # twenty and then adding that many spaces # to the output. # replace ', " " x (20 - length $1)' # with ', "\t"' if you want a tab instead print ucfirst($1) , " " x (20 - length $1) , $2 , "\n"; } } __DATA__ FEATURE /group=" " /translation="MMSKLGVLLT ICLLLFPLTA VQLDGDQPAD +LPALRTQDIA TDHSPWFDPV KRCCSRYCYI CIPCCPN" /disulfide="9,19" /disulfide="13,24" /hydroxylation="10" /hydroxylation="11" /post_trans_mod="
update: Added code comments

In reply to Re: extra spaces before \r\n by trs80
in thread extra spaces before \r\n by agustina_s

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.