Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^4: Out of Memory

by BrowserUk (Pope)
on Mar 28, 2013 at 17:40 UTC ( #1026007=note: print w/ replies, xml ) Need Help??

in reply to Re^3: Out of Memory
in thread Out of Memory

Holding a 5MB string in memory is hardly onerous.

The problem is entirely down to creating a huge list of scalars each containing a single character in order to count those characters.

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.

Comment on Re^4: Out of Memory
Replies are listed 'Best First'.
Re^5: Out of Memory
by davido (Archbishop) on Mar 28, 2013 at 17:46 UTC

    You're right. :)

    This really should be a job for tr///, shouldn't it?

    my $string = '5mb of stuff'; my $count = $string =~ tr/\0/\0/;

    (I probably just missed seeing that proposed somewhere within the thread.)

    Update: Ah, I see it's the first thing you proposed (good job). This is probably a good time for me to walk away from the keyboard for awhile. ;)


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2015-10-10 11:21 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (255 votes), past polls