pglinx has asked for the wisdom of the Perl Monks concerning the following question:
open(FILE, "herbalarea.pl") || die "I can't open that because: $!\n"; while(<FILE>) { chop; @all = split(/\n/); foreach $line (@all) { local($hStoreID, $hStoreLatitude, $hStoreLongitude) = split(/ /, + $line); $lat2 = $hStoreLatitude; $lon2 = $hStoreLongitude; $lat1 = $lat1a; $lon1 = $lon1a; # Notice the 90 - latitude: phi zero is at the North Pole. @L = (deg2rad($lat1), deg2rad(90 - $lon1)); @T = (deg2rad($lat2), deg2rad(90 - $lon2)); $km = great_circle_distance(@L, @T, 6378); #-------HERE IS THE PROBLEM---------# @km=sort {$a <=> $b} (@zip_dist); $km = (@zip_dist); #-----------------------------------# if ($km < $distance) { $match = 1; $count ++; $area = "$hStoreName <BR> $hStoreAdd <br> $hStoreCity, $hStoreProv + $hStorePC\n"; $rounded = sprintf("%.1f", $km); print " $area $km \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sort by distance
by ikegami (Patriarch) on May 27, 2009 at 13:52 UTC | |
|
Re: Sort by distance
by jettero (Monsignor) on May 27, 2009 at 13:53 UTC | |
|
Re: Sort by distance
by Anonymous Monk on May 27, 2009 at 13:57 UTC | |
|
Re: Sort by distance
by DStaal (Chaplain) on May 27, 2009 at 13:56 UTC | |
by pglinx (Acolyte) on May 27, 2009 at 14:23 UTC | |
by DStaal (Chaplain) on May 27, 2009 at 14:35 UTC | |
by pglinx (Acolyte) on May 27, 2009 at 14:53 UTC | |
by DStaal (Chaplain) on May 27, 2009 at 16:21 UTC | |
by Marshall (Canon) on May 28, 2009 at 00:14 UTC | |
|
Re: Sort by distance
by hda (Chaplain) on May 27, 2009 at 16:11 UTC |