in reply to Database issues

I assume you are referring to some DBM tied hash. What do you mean how can it overwrite itself?

A possible scenario i can think up:
You have dbm with some data in it. the $key this is some data, and it's value $that are stored beside some other values in the hash.
You want to delete the old value of $this, the one from the previous form submit, and create a new one relevant to the new $this?

The simplest way to do this is to store an extra key in the hash, a constant one named 'current_this' or whatnot, with the value of $this, to be used as the new key. But this is a bit backwards to start with. Perhaps you should rethink your implementation?

-nuffin
zz zZ Z Z #!perl

Replies are listed 'Best First'.
Re: Re: Database issues
by Anonymous Monk on Apr 09, 2003 at 16:21 UTC
    What I'm trying to do is get store $name and $age from a form into a database. So I try using $stats{$name} = $age; thinking that would give store a list like (see below) for me. What am I doing wrong?

    George Clinton 10000 Bill Bush 9999999 Pocahontas 20 Godzilla 123
      foreach $name (qw(George Bill Pocahantas Godzilla)){ $stats{$name} = int rand(10); # give the name a random value } while(my ($key,$value) = each %stats){ print "$key is $value years old\n"; }
      Does this help?

      -nuffin
      zz zZ Z Z #!perl
        not really, I can't pull a foreach off things collected from a form (maybe you can, I just don't see how it would work). Thanks.