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

I am new to perl and I am trying to read and create a hash from a very LARGE file (33GB) for later processing. I am using tie and DBM::Deep but cannot get pass errors. My "tie" is: tie my %f1, "DBM::Deep", "mydb.sdbm", pack_size => 'large'; I would appreciate any help on how to set the pack_size. Thx

Replies are listed 'Best First'.
Re: pack_size for DBM::Deep
by sierpinski (Chaplain) on Jul 14, 2010 at 14:29 UTC
    Is your perl compiled for 64bit? From the DBM::Deep POD:

    large

    This uses 8-byte offsets, allowing for a maximum file size of 16 XB (exabytes). This can only be enabled if your Perl is compiled for 64-bit.


    What problem are you having?
      Thanks for the quick response. Sorry not to give more information. I am running on Windows 7 using perl64. I get the following error:
      DBM::Deep: Odd number of parameters to 124 at tie_temp2.pl line 10

      My test program is as follows:

      #!/usr/bin/perl use strict; use warnings; use DBM::Deep; use Fcntl; # For O_RDWR, O_CREAT, etc. my $f1 = shift or die "usage: $0 file1 file ...\n"; open my $f, "< $f1" or die "$f1: $!\n"; tie my %f1, "DBM::Deep", "mydb.sdbm", pack_size => 'large'; while (<$f>) { $f1{$_}++; } while (<>) { # The rest of the files if (exists $f1{$_}) { print "GOOD\n"; } else { print "BAD\n"; } } untie %f1;
        The documented usage is
        tie my %f1, "DBM::Deep", { file => "mydb.sdbm", pack_size => 'large', };

        Welcome to the Monastery, please don't ignore the formatting advice given each time you post:

        Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!

        See also How do I post a question effectively?.