Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: cleaving a sequence with specific alphabets

by prasadbabu (Prior)
on May 21, 2008 at 11:16 UTC ( #687747=note: print w/replies, xml ) Need Help??


in reply to cleaving a sequence with specific alphabets

If I understood your question clearly, here is my solution. You can use negative look behind regex and split function to accomplsh it. TIMTOWTDI.

$string = 'APADPKGSTIDRPDAARTLTVHKCEQTDTRGVKEGTRNEDPQAECKPVSDVEFTITKLN +VD'; @arr = split /(?<!P)(K|R)/, $string; print @arr; output: ------- APADPKGSTIDRPDAARTLTVHKCEQTDTRGVKEGTRNEDPQAECKPVSDVEFTITKLNVD

Take a look at perlre and split function.

Prasad

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://687747]
help
Chatterbox?
[Corion]: ambrus: Hurr - yes, that might happen, as Prima will queue lots of stuff (Well, Windows will)
[Corion]: But I'm really amazed that it just took this little code (plus the idle handler I have in mind and something else dk suggested)
[Corion]: ambrus: I wrote the handler so that it stops the timer if it's supposed to be a one-shot
[Discipulus]: are you using Prima Corion? good morning Corion and ambrus, btw

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2016-12-09 09:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.