Anders Stegmann wrote:
Hi! Why doesn't this work?
Aargh! *Please* see http://perl.plover.com/Questions4.html You're expecting us to read your mind, so here goes...
use strict; use warnings; my %result_hash = qw(foo bar); dbmopen(%result_hash, >>BB, 0666);
"BB" needs to be quoted, and the >> syntax is not supported here. This statement clobbers whatever was previously in %result_hash. If you want to add stuff to the dbm file, open it first, then add the stuff. Error checking?
dbmclose(%result_hash); dbmopen(%result_hash, BB, 0666);
Need quotes around "BB", and need error checking.
while (my ($key,$val) = each %result_hash) { print $key,\n;
Again, you need quotes here.
} dbmclose(%result_hash);
Note that dbmopen/dbmclose are deprecated in favor of the tie syntax. see e.g., perldoc DB_File -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>