in reply to Output of hash
You are using arrays @k and @v so both key and value go into @k and @v gets nothing. Use scalars $k and $v instead.
Cheers,
JohnGG