Hi!
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
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
Hi!
Why doesn't this work?
use strict;
use warnings;
my %result_hash = qw(foo bar);
dbmopen(%result_hash, BB, 0666);
dbmclose(%result_hash);
dbmopen(%result_hash, BB, 0666);
while (my ($key,$val) = each %result_hash) {
print $key,\n;
}
dbmclose(%result_hash);
in the primary
hash, so I know which entry has which value.
Anders.
Shawn Corey [EMAIL PROTECTED] 01/15/06 7:16 pm
Anders Stegmann wrote:
Hi!
how do I assign a list to a hash entry like $hash{$key}[0].
I mean, something like this:
$hash{$key}[0] = @list;
must work.
Anders.
Close. Try
Hi!
how do I assign a list to a hash entry like $hash{$key}[0].
I mean, something like this:
$hash{$key}[0] = @list;
must work.
Anders.
Hi!
I have a script like:
%hash = qw(1 A 2 B 3 C);
while (($key, $value) = each %hash) {
print $key = $value\n;
}
it prints out:
1 = A
3 = C
2 = B
I want it to print out a sorted hash like:
1 = A
2 = B
3 = C
How do I do that?
Regards Anders.
Anders Stegmann
Ph.d. student
Thanks for replying!
I think I tried everything but that!
Anders.
Anders Stegmann
Ph.d. student
Royal Veterinary and Agricultural University
Institute of Food Science
Section of Food Microbiology
Rolighedsvej 30
Building 2-74
Room R074
DK-1958 Frederiksberg C
Tlf. +45 35 28 31 58
Charles K