$|=1; for(1..<>){ ($a,$b,$c,$d)=glob<>; print "SELECT count(*) FROM point WHERE x>=$a AND x<=$b AND y>=$c AND y<=$d;\n" }