in reply to extra spaces before \r\n

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