in reply to how do i pass qoutes to in the string.

Hi. two options out of several possible: use qq or escape the "s within the string.

$query = qq|select zipcount from table where id = emailid and address +!= "" and first != "" group by c.z5|;

or

$query = "select zipcount from table where id = emailid and address != + \"\" and first != \"\" group by c.z5";

qq|| - the double quote operator - does exactly the same as "", but is not closed by a ". Very useful for keeping html (and SQL, i guess) readable within perl. See perlop for more.

Actually, in your example you could just use single quotes to enclose the select string, since you're not interpolating anything, but i expect you'll end up with a variable in there at some point.