Brett,
Hi, I tried to do this, but it didn't really work because first I
declare an array like this:
my @day;
Then I did as you said...
Then, I add information using things like:
$day[$ext]{$line[2]}{$line[0]}{pages}=$line[1];
I checked out the database file and there was stuff like this in there:
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@
^@^@^AHASH(0x87166b8)^A20010612^AHASH(0x868a7e8)^A20010609^AHASH(0x85d52
c8)^A200
10605^AHASH(0x85179dc)^A20010601^AHASH(0x84e8da4)^A20010519^AHASH(0x842a
850)^A20
010515^AHASH(0x82e47e8)^A20010528^AHASH(0x8228b60)^A20010524^AHASH(0x816
a698)^A2
0010520^@^@^@^@^@^@^@^@^B^@^@^@^@^@^@^@^@^@^@^@^N^@Q^O^@^B÷^Oç^OÞ^OÎ^OÅ^
Oµ^O¬^O
<9C>^O<93>^O<83>^Oz^Oj^Oa^OQ^O^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@^@^@^@
I think that the problem is that the database file in this case just
holds information on where the hashes are in memory and not all of the
information in the hashes(???) Do you have any idea of how could I
declare that I want the database file to keep track of the hashes?
Thanks,
Bryan
-----Original Message-----
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 13, 2001 2:40 PM
To: Bryan Gmyrek
Cc: [EMAIL PROTECTED]
Subject: Re: Huge hash ... running out of memory without warning???
On Wed, 13 Jun 2001, Bryan Gmyrek wrote:
> I have just written a program that makes an array of hashes of hashes
of
> hashes. It reads all kind of information in from a bunch of files and
> then later I access the elements of this thing in a convienient way
> because it's kind of like a little database. Anyways, I end up
printing
> everything out into a very big html table. I noticed that *sometimes*
> nothing is printed when I say 'print this part of that array...'
> Thought it was a bug in the code, but then I ran the program on a
> machine with more memory and *now* the elements that were missing
> previously are printed, but some 'further on down the line' are not.
It
> seems that the computer is running out of memory and at some point no
> data really gets added to this monster of a list of lists... What the
> heck should I do so that I can perform these functions, but not run
into
> this problem of running out of memory?
You might want to look into using DB_File -- your hash will use your
disk
as a sort of 'virtual memory', plus your hash will be persistent between
calls of your script:
use DB_File;
tie %myhash, "DB_File", $filename or die "Can't open $filename$!\n";
#do stuff to gather data
$myhash{$somekey} = $somevalue;
#do more stuff with your data
untie %myhash;
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Youth. It's a wonder that anyone ever outgrows it.