in reply to Zip code distance search

I think you want something like this:
my $distance = distance($zipcood, $hStoreLatitude, $hStoreLongitude "M +"); if ($distance < $selectmiles) { $match = 1 ... }
And use "my" instead of "local"...