in reply to Improve code to parse genetic record

If the "!" lines are getting in the way, why not substitute them out before you split the record?
my @bangs = $record =~ m/^[^\n]*\![^\n]*\n/mg; $record =~ s/^[^\n]*\![^\n]*\n//mg;
Update: I have fixed the above pattern to avoid the evil ".*" (per Death to Dot Star!). Since the "!" lines have information, I gather the assumptions Enlil and BrowserUK made about whitespace are incorrect. I have added a capturing match to take care of keeping the information.

Replies are listed 'Best First'.
Re: Re: More efficient?
by Anonymous Monk on Apr 30, 2003 at 23:00 UTC
    Because although for my quick'n'dirty purposes, this would suffice, the program is intended to be a parser and as the ! lines do represent information, I should have the means in place to grab them.