This doesn’t work:
my %y = ("lkj",34);
my %i = ("lkj",66);
my @e = (\%y, \%i);
my $u = ${%{$e[0]}}{"lkj"};
but this does:
my %u = %{$e[0]};
print $u{"lkj"};
If I don’t feel like typing that extra line what do i do.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You use the
->operator:You can do something similar for arrayrefs, and it’s even chainable:
As a bonus, you can do all the setup in a single line too by using the
{}shorthand for arrayrefs: