On Wed, 13 Jun 2001, Bryan Gmyrek wrote:
> 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];
Oh, yeah, you're doing some pretty complex data structures there. You
will want to use the MLDBM module instead. You'll have to get it from
CPAN. It is uses Data::Dumper to store complex data structures. It works
like this:
use MLDBM 'DB_File';
tie (%myhash, 'MLDBM', [other args]) or die "...";
$myhash{$somekey} = ["some data", "more data"];
Be very careful, though, because you can't do:
$myhash{$somekey}->[0] = "even more data";
This is a limitation of the hash interface (you can't manipulate data via
references on the disk). Instead, use temp variables:
$moredata = $myhash{$somekey};
$moredata->[0] = "even more data";
$myhash{$somekey} = $moredata;
-- Brett
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Having a wonderful wine, wish you were beer.