in reply to Re: Database issues
in thread Database issues

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

Replies are listed 'Best First'.
Re: Re: Re: Database issues
by nothingmuch (Priest) on Apr 09, 2003 at 16:26 UTC
    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.

        Have a look at Common Beginner Mistakes (item: Repetition without Abstraction).

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law