[Israel.pm] a hash question

Eitan Schuler Eitan.schuler at exlibris.co.il
Mon Feb 2 11:07:32 PST 2004


Shlomi,
Thank you for your quick help, 
DB_File deals with hashes very well, and easy to use.
Just in case if anybody intersted:

        use DB_File;
        my $X = tie %myhash,  "DB_File", "C:\\temp\\hehe.dat",$DB_HASH or
die "can't open file";

        #pushing values
        $X->put("a",3);
        $X->put("b",4);
        $X->put("c",7);
        
        #checking if exists
        print "a exists in myhash\n" if $myhash{"a"};
        
        #Getting a value
        $X->get("c",$value);
        print "a is $value\n";
        
        untie %myhash;

Eitan


-----Original Message-----
From: Shlomi Fish [mailto:shlomif at iglu.org.il]
Sent: Monday, February 02, 2004 8:07 PM
To: Perl in Israel
Subject: Re: [Israel.pm] a hash question


On Monday 02 February 2004 19:57, Eitan Schuler wrote:
> Hello All,
> I am wondering if someone can help me;
> I build a hash, which may cause to memory problems because of it's size.
> I am searching for a module which can deal with very big hashes by using
> the hard-disk.
>
> If anyone has used such module, please advise.
>

Try the DB_File/GDBM_File/NDBM_File/SDBM_File/etc. family of modules. This 
will work well unless you wish to store scalar values other than strings as 
the hash values. In this case, you'll need more sophisticated solutions, 
which are out of the scope of this E-mail.

Regards,

	Shlomi Fish



> Sincerely
> Eitan Schuler
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://www.perl.org.il/mailman/listinfo/perl
>
> YAPC::Israel::2004
> http://www.perl.org.il/YAPC/2004/

-- 

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://t2.technion.ac.il/~shlomif/

I don't believe in fairies. Oops! A fairy died.
I don't believe in fairies. Oops! Another fairy died.

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://www.perl.org.il/mailman/listinfo/perl

YAPC::Israel::2004
http://www.perl.org.il/YAPC/2004/



More information about the Perl mailing list