hello all, plaese tell me how can i pass a hash table to the javascript from a perl function as an arguments?

i'm trying as below...in perl function hash table sent as an argument, in javascript it is receiving as below....but its not working,,,,
    alert('size of hash table ' +HashRowUnit.length); 
for (var k in HashRowUnit) {   
if (HashRowUnit.hasOwnProperty(k)) {  
alert('key is: ' + k + ', value is: ' + HashRowUnit[k]);} }