[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-AnyPerl] storing a DBM file



MIME-Version: 1.0
Content-Type: text/plain; Charset=US-ASCII
X-Mailer: Mailsmith 1.1.3 (Bluto)
Message-ID: <19990731203638812.AAA291.361@[207.234.184.135]>
Date: Sat, 31 Jul 1999 15:37:17 -0500
In-Reply-To: <199907301100.EAA13739@cfcl.com>
>From vlb@cfcl.com  Sat Jul 31 13:39:43 1999

Hi-

I am having trouble storing a DBM file.  What I am trying to do is 
this:  I read
in, line-by-line, a large database (15 fields, 15,000 records), keyed 
by control
numbers and split it into a hash (where each value is a 8-piece array).  I then
modify the data in each of the eight fields of the array.  Finally I want to
resave the modified hash for quick searches.

I have accomplished all of this except for the last step of saving the file.
None of "("Learning "|"Programming "|"Mac")Perl" are clearing this up for me.
Here is my code:


############SNIP#######
## First I genereate the big hash, called %parsed.
## This works fine, and I am able to use it as I want.
############SNIP#######

     %saveparsed =%parsed;

  foreach $num (keys %saveparsed) {
     print STDOUT "\nSAVEPARSED $num: $saveparsed{$num}[4]  ";}

### At this point, "%saveparsed"  behaves as I want it to, with all of the
### appropriate info in the values.

  dbmopen(%saveparsed, 'parsed.nsh', 0666) || die ("Could not open parsed: $!");
  %saveparsed =%parsed;
  foreach $num (keys %saveparsed) {
     print STDOUT "\nSAVEPARSED $num: $saveparsed{$num}[4]  ";}

   dbmclose(%saveparsed) ||die "Couldn't dbmclose: $!"
########################

After I dbmopen though, the same print routine returns nothing but the list of
keys, with no values associated.   @{ $saveparsed{$num}} behaves the same way.

What is the critical symbol that my dbmopen call is missing to let me do this?
 
 
     -Adam

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org