UndergroundVault
UndergroundVault

Reputation: 130

Perl "keys on reference is experimental" warning

My perl program is throwing some warnings, and I am yet to have any luck searching the Internet for a solution. Is there any way I can rewrite the following code snippet so that no warnings are thrown?

"keys on reference is experimental at...":

foreach my $key ( keys %$api_decoded_result{'query'}->{'pages'} ) {
    @words = split / /, $api_decoded_result->{'query'}->{'pages'}{$key}->{'extract'};
}

Upvotes: 2

Views: 2073

Answers (1)

Sobrique
Sobrique

Reputation: 53498

Yup. This is because of precedence of operator dereferencing. %$api_decoded_result binds tighter than the {'query'}.

keys %{$api_decoded_result{'query'}->{'pages'}}

Will do what you want.

Upvotes: 5

Related Questions