[EMAIL PROTECTED] wrote:
On Jan 14, 6:18 pm, [EMAIL PROTECTED] (Rob Dixon) wrote:
[EMAIL PROTECTED] wrote:
>
This is the bit of code I'm attempting to use,
"$workPackages{ $tempHash{ WORK_PACKAGE } }
{ $tempHash{ USE_ON_CODE } } = $tempHash{ TECHNICAL_DIRECTIVE };" I
get the following error, "Can't use string ("1") as a HASH ref while
"strict refs" "
Is this because the value stored needs to be the reference to the new
hash? If so, how do I do this? Do I need to reset the original hash
value from 1 to null?
You're assigning the value of
$tempHash{TECHNICAL_DIRECTIVE}
to
$workPackages{$tempHash{WORK_PACKAGE}}->{$tempHash{USE_ON_CODE}}
and the error is because
$workPackages{$tempHash{WORK_PACKAGE}}
has the value 1 instead of being a hash reference.
There's little here to help me guess what has gone wrong. Can you tell
us more about your data structures and how they have been built please?
How do I change the value stored to a hash reference? That's really
what I would like to do. Thanks.
Well that's still not very explicit, but lets have a go. Suppose you
have
my $hashref = {
aa => 1,
bb => 2,
cc => 3,
};
and you want to change the value of the element with key 'bb' then you
can write
$hashref->{bb} = 3;
Is this getting close?
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/