简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM