in reply to Is a point in a polygon?

Where's the problem? You wrote already condition, now write

for $pid (0..$num_of_points-1) { for $polyid (0..$num_of_polygons-1) { 'do something' if <your condition> } }
and that's it.

Maybe there is a problem with speed? Or really great number of data? Some sorting would help here? Please write more info if you need more help.