I searched SO before asking this question, I am completely new to this and have no idea how to handle these errors. By this I mean Perl language.
When I put this
%name->{@id[$#id]} = $temp;
I get the error Using a hash as a reference is deprecated
I tried
$name{@id[$#id]} = $temp
but couldn’t get any results back.
Any suggestions?
The correct way to access an element of hash
%nameis$name{'key'}. The syntax%name->{'key'}was valid in Perl v5.6 but has since been deprecated.Similarly, to access the last element of array
@idyou should write$id[$#id]or, more simply,$id[-1].Your second variation should work fine, and your inability to retrieve the value has an unrelated reason.
Write
and
will display
testcorrectly