Perl Loop Through Json Array Javascript Length Function In Sql