UndergroundVault UndergroundVault - 1 year ago 59
Perl Question

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'};


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.