in reply to Re^2: Need something like a SQL query for JSON data structures (JSON::XS)
in thread Need something like a SQL query for JSON data structures (JSON::XS)

With a simple hash, to grep the keys:

my @results = grep /taco/, keys %hash;

To grep the values:

my @results = grep /taco/, values %hash;

To get the keys whose values match a regex:

my @results = map {$hash{$_} =~ /taco/ ? $_:  ()} keys %hash;

Replies are listed 'Best First'.
Re^4: Need something like a SQL query for JSON data structures (JSON::XS)
by walkingthecow (Friar) on Sep 06, 2013 at 06:25 UTC
    json_decode in my context returns an array of hash references. I posted the method that worked for me, though there may be an easier/better way to do it.