B
Bryan
Another one...
I have a structure of key value pairs, where the key is an array, and
the value is a scalar. I would have preferred to use the scalars as the
keys, but there may be duplicates, whereas I know the arrays do not.
In passing in such a structure to a function by reference, how do I
assign a local var to the array ref inside the hash ref?
I need to traverse over the thing:
while ((my $array_ref, my $value) = each(%$hash_ref)) {...}
Doesnt work, it thinks $array_ref is a string with "REF(0x1e17594)" as a
value.
while((my @$array_ref...
Doesnt work, dereferencing error.
Im starting to think I am using the wrong structure, but that is really
the structure of my data: 1-1 key-value relationships, where the array
is the unique element and therefore the key. Right?
Dunno. How do I get my array back? I create it like so btw:
$hashref->{\[@key_array]} = $value;
Maybe that is messing me up.
Help?
B
I have a structure of key value pairs, where the key is an array, and
the value is a scalar. I would have preferred to use the scalars as the
keys, but there may be duplicates, whereas I know the arrays do not.
In passing in such a structure to a function by reference, how do I
assign a local var to the array ref inside the hash ref?
I need to traverse over the thing:
while ((my $array_ref, my $value) = each(%$hash_ref)) {...}
Doesnt work, it thinks $array_ref is a string with "REF(0x1e17594)" as a
value.
while((my @$array_ref...
Doesnt work, dereferencing error.
Im starting to think I am using the wrong structure, but that is really
the structure of my data: 1-1 key-value relationships, where the array
is the unique element and therefore the key. Right?
Dunno. How do I get my array back? I create it like so btw:
$hashref->{\[@key_array]} = $value;
Maybe that is messing me up.
Help?
B