Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Fast Way to Split String in to Chunk of Equal Length

by BrowserUk (Pope)
on Nov 25, 2011 at 20:23 UTC ( #940126=note: print w/replies, xml ) Need Help??


in reply to Re^2: Fast Way to Split String in to Chunk of Equal Length
in thread Fast Way to Split String in to Chunk of Equal Length

At it again. Unannounced updates. The above post originally consisted entirely of just:

Any implementation in mind? Something like the following?
while ($seq =~ /(.{3})/sg) { # Substring in $1 ... }

To answer the dumb question that wasn't there originally,

How can you not know in advance how many fields there are (int(length($seq)/3))?

If you have to calculate the number, you throw away the few percent gained.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2020-04-10 07:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (49 votes). Check out past polls.

    Notices?