>>>Anders Stegmann 02/06/06 1:02 pm >>> Thaks for replying! The hash has only one key, so it sould be okay. I get the output: Can't use string (ARRAY(0x648290)) as an ARRAY ref while strict refs in use at testhash6.pl line 8. When I run the script. It seems like I am somehow dealing with a reference to an array!? Or what? Anders.
>>>John Doe <[EMAIL PROTECTED]> 02/06/06 12:55 pm >>> Anders Stegmann am Montag, 6. Februar 2006 12.30: >Hi! Hi Anders >Can anyone tell me why this script doesn't work? > > >use strict; >use warnings; > >my %hash = (); > >my $key1 = 'nul'; >my $en = 'en'; >my $to = 'to'; >my $tre = 'tre'; > > >$hash{$key1} = [$en, $to, $tre]; > >dbmopen(my %dbm_result_hash, 'hash_database', 0666) or die cannot save >database_name to dbm\n; No quotes around the string after die. This is a syntax error. >%dbm_result_hash = %hash; > >dbmclose(%dbm_result_hash); > >dbmopen(my %dbm_hash, 'hash_database', 0666); > >my ($key) = keys %dbm_hash; Not shure if this is intended. $key contains the first key of the list of keys from %dbm_hash, which itself has not a specific order. >print $dbm_hash{$key}[2],\n; > >dbmclose(%dbm_hash); > >exit; No need for an exit at the end of a script. btw, from perldoc -f dbmopen: dbmopen HASH,DBNAME,MASK [This function has been largely superseded by the tie function.] hth, joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>