in reply to whats the problem with this line?

What does your server error log say? If you can't read your error log, try putting:
use CGI::Carp qw(fatalsToBrowser);
in your script.

Also, what kind of thing is $cols? Is it a simple scalar, or it is an object that has a stringify method? We will probably need to see more of your script.