in reply to Receinving hash where expecting a string

I'm getting hash references such as HASH(0x1875380) instead of the expected names
Where? It would be helpful if you were to tell us which line(s)

However, your code contains:

if ({$_}) {

This is definately wrong and should have got have got you a "Odd number of elements in anonymous hash" warning. Should it be

if ($cols{$_}) {

?