Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Efficient walk/iterate along a string

by Corion (Pope)
on Nov 22, 2010 at 23:02 UTC ( #873070=note: print w/ replies, xml ) Need Help??


in reply to Efficient walk/iterate along a string

substr isn't exactly cheap - depending on what you really want to do with a single character, a regular expression moving across the string might (or might not) be faster. See perlop and perlre for /gc.

while ($protein =~ /\G(.)/gc) { print $1; ... };


Comment on Re: Efficient walk/iterate along a string
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://873070]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2014-10-20 09:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (74 votes), past polls