in reply to Returning data
Here, string contcatenation doesn't work with hashes
%output .= ( 'items' => [("title" => "$title")] );
I'm guessing you want something like this:
$output{items} ||= []; push @{$output{items}}, {title => $title};
You should probably take a look at perldsc to see how you can use nested hashes & arrays
Also, the content type here should most likely be 'application/json'
print "Content-type: text/html\n\n"; print $results;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Returning data
by cavac (Prior) on Apr 20, 2024 at 22:34 UTC | |
by frank1 (Monk) on Apr 21, 2024 at 08:55 UTC | |
Re^2: Returning data
by frank1 (Monk) on Apr 21, 2024 at 08:53 UTC |