in reply to perl dbm problem

Hi,

You seem to be overwriting the entries in your dbm, no? Only the last values entered in the form are saved. Won't you better first read your dbm from disk in your hash and then add the new entries from the form? That way you'll preserver your old entries.

Also, keys( %BOOK ) won't give you a number but will show you 'name','email','comments', and 'posttime', not a number. Is that what you want? (I goofed up!)

-- if ( 1 ) { $postman->ring() for (1..2); }

Replies are listed 'Best First'.
Re^2: perl dbm problem
by fishbot_v2 (Chaplain) on Aug 31, 2005 at 14:33 UTC

    Also, keys( %BOOK ) won't give you a number but will show you 'name','email','comments', and 'posttime', not a number.

    That is not correct. keys in a scalar context returns the number of keys:

    my %hash = ( foo => 1, bar => 2, baz => 3 ); print "There are " . keys( %hash ) . " keys\n"; # output There are 3 keys