Hi
I am trying to pass a 2 element array (each element consisting of a hash with three fields, let's call them a, b & c...)
I pass to the func by reference, e.g.
I try referencing a variable to get hold of the array:
But how do I now read off a hash element at a time?? I.e. I'd like to be able to do:
Doesn't work though.. I get the error:
I.e. $hashElement hasn't got any values/keys in it.. I suspect that my array of hashes is now just a list of strings (the keys and values having lost their meaning) - any way of getting round this?
Cheers
L00n
I am trying to pass a 2 element array (each element consisting of a hash with three fields, let's call them a, b & c...)
I pass to the func by reference, e.g.
Code:
&function(\@myArrayOfHashes);
I try referencing a variable to get hold of the array:
Code:
my $reference = shift;
But how do I now read off a hash element at a time?? I.e. I'd like to be able to do:
Code:
my %hashElement = pop @{$reference};
print "These are my hash values: ";
print $hashElement{'a'} .", ";
print $hashElement{'b'} .", ";
print $hashElement{'b'} .", ";
Doesn't work though.. I get the error:
Code:
Use of uninitialized value in concatenation (.)
I.e. $hashElement hasn't got any values/keys in it.. I suspect that my array of hashes is now just a list of strings (the keys and values having lost their meaning) - any way of getting round this?
Cheers
L00n