in reply to Type of arg 1 to keys must be hash (not array dereference) at

Hi demichi,

The keys function has gone though several changes as to what it accepts as its argument over the years, the ability to return the indicies of an array when called like keys @array was added in Perl 5.12.

The last release of Perl in the 5.10 series was in 2009, so the first thing I'd recommend is that you look into upgrading your Perl.

If you can't do that for whatever reason, then you can replace (keys @{ $json_decoded->{$key1} }) with (0..$#{ $json_decoded->{$key1} }) - see the Range Operators and the $#array syntax in perldata (search for "$#").

Hope this helps,
-- Hauke D

Replies are listed 'Best First'.
Re^2: Type of arg 1 to keys must be hash (not array dereference) at
by demichi (Beadle) on Nov 20, 2016 at 19:14 UTC
    Works perfect! Thanks Hauke.