I see that you added the code tags, but now your code is no longer valid perl syntax due to the appearance of extra <br> tags on every line.
I see that you fixed the formatting problems, but now when I run your code I get an error related to improperly formatted JSON. When I run your code as is, I get this error
'"' expected, at character offset 811 (before "<br>\n "count...") at t.pl line 108.
When I manually remove the offending <br>
tag, I finally get the error that you mentioned
Not a HASH reference at t.pl line 110.