Rahul6990 has asked for the wisdom of the Perl Monks concerning the following question:

Is there any limit to store the values in hash? Have any one tried? I need to try to load about 1 lac values in hash. Is it recommended or else any suggestion welcome...

Replies are listed 'Best First'.
Re: Storing large data in perl hash
by davido (Cardinal) on Jan 25, 2013 at 07:34 UTC

    my %hash; for ( 1 .. 100000 ) { $hash{$_} = "What did you try?"; } print "We just created a hash with ", scalar( keys %hash ), " elements +.\n";

    Works for me.


    Dave

Re: Storing large data in perl hash
by BrowserUk (Patriarch) on Jan 25, 2013 at 07:34 UTC
    Is there any limit to store the values in hash?

    Only the memory limits of your machine and userid.

    Have any one tried? I need to try to load about 1 lac values in hash.

    Yes. I routinely load 10s of millions of values into Perl hashes. 100,000 is no problem at all.


    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.
Re: Storing large data in perl hash
by frozenwithjoy (Priest) on Jan 25, 2013 at 07:03 UTC
    I wasn't familiar with 'lac'. Is it 100,000?
      yes
Re: Storing large data in perl hash
by Rahul6990 (Beadle) on Jan 25, 2013 at 07:43 UTC
    Thanks everyone for help