Please note Jenda's post, especially his point 4. You will get into problems if you don't sanitize the input. Also you should clean up your intendation

I would have prefered if you had posted your last attempt and mentioned how it was not working. Then I could have shown you the bug and even how to find it. I'll give you more context, but I don't want to do the work of changing every single occurence of your many variables, this fine tuning you have to do yourself. Just add all the variables needed for the web page at the two places where I put '...' using the same syntax

$count = 0; my %inarea; open(FILE, "herbalarea.pl") || die "I can't open that because: $!\ +n"; while(my $line= <FILE>) { chomp $line; local($hStoreID, $hStoreName, $hStoreUserName, $hStorePassword, $h +StoreMCRSPassword, $hStoreCity, $hStoreProv, $hStoreAdd, $hStoreAdd2, + $hStorePC, $hStoreCountry, $hStoreEmail, $hStorePhone, $hStoreType, +$hStoreLatitude, $hStoreLongitude, $hStoreFirstName, $hStoreLastName, + $hStoreHPhone, $hStoreCPhone, $hStoreEmail2, $hStoreOwner, $hStoreAd +min, $hStoreAdmin2, $hStoreAdmin3, $hStoreActive, $hStoreWeb, $hStore +Lang, $hStoreDesc, $hStoreShowMap, $hStoreComingSoonText, $hStoreComi +ngSoonTextFrench, $hStoreVanityName, $hStoreWebCreatedDate, $hStoreLa +stLogin, $hStoreLastEnabled, $hStoreManagerEmpID, $hStoreURL) = split +(/ /, $line); $lat2 = $hStoreLatitude; $lon2 = $hStoreLongitude; $lat1 = $lat1a; $lon1 = $lon1a; @L = (deg2rad($lat1), deg2rad(90 - $lon1)); @T = (deg2rad($lat2), deg2rad(90 - $lon2)); $km = great_circle_distance(@L, @T, 6378); if ($km < $distance) { $match = 1; $count ++; $area = "$hStoreName <BR> $hStoreAdd <br> $hStoreCity, $hStorePro +v $hStorePC\n"; $area1 = "$hStoreAdd $hStoreAdd2 $hStoreCity, $hStoreProv $h +StorePC\n"; $area2 = "$hStoreCity, $hStoreProv\n"; $inarea{$km}= {area=>$area, area1=>$area1, hStore=>$hStore ... }; } foreach my $km ( sort keys %inarea ) { my $area= $inarea{$km}{area}; my $area1= $inarea{$km}{area1}; ... print " <table border=0 width=240 height=105 cellpadding=15 cellspacing=0 back +ground=\"http://pagelinx.com/herbalmagic/files/loc_bck.gif\"> <tr> <td style=\"font-size: 11px; color: #5D5D5D;\"> Store # <A HREF=\"javascript:change1('pic1','image$count')\">$area</A> +<BR>\n"; print "<div class=\"book\"> <A HREF=\"http://www.pagelinx.com/herbalmagic/form.php?center=$hStoreN +ame&address=$hStoreAdd&city=$hStoreCity&prov=$hStoreProv\" target=_pa +rent>Book Your Free Consultation</a> - KM $km</div></A></td> </tr> </table> \n"; } } }

In reply to Re^3: Sort output by jethro
in thread Sort output by pglinx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.