Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
A text file with a single line consisting of ~155e6 characters, all 0's and N's, is read in as a scalar variable. Each character is assigned to a single element of an array As a scalar, your 155e6 file will require ~ 150 MegaBytes of memory. As an array, 1 char per element, it will require ~ 10 GigaBytes of memory. Assuming you have that available. But for your stated goal: The goal: change all elements of the @info array that lie outside of my intervals to N's. There is no need to go through the time and memory costly process of spliting your string to an array. And no need to iterate over 155 million characters one at a time. You can easily and quickly overwrite the characters outside your ranges with 'N's, in-place in the scalar:
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.
In reply to Re^3: A question About Array Indexing
by BrowserUk
|
|