#************************************************************
#** This Perl example is provided "as is". This code is **
#** not supported, but I will try to answer questions as **
#** time allows. Email: wizjd@panix.com **
#** Visit: for updated, **
#** and new examples. **
#************************************************************
#!/usr/local/bin/perl
print("Content-Type: text/html\n\n");
print("
Clickmap Example Page\n");
print("\n");
($clicked_x, $clicked_y) = split(/,/,$ENV{QUERY_STRING});
#print "x=", $clicked_x, " y =", $clicked_y, "
\n";
#look thru our coordinates file for state this x/y belongs too.
open(INFILE,"states.dat");
$got_state = "";
while () {
chop;
($state_name, $x1, $y1, $x2, $y2) = split(/:/);
if( $clicked_x > $x1 && $clicked_x < $x2
&& $clicked_y > $y1 && $clicked_y < $y2 )
{ $got_state = $state_name; }
}
if ($got_state eq "")
{ print "ERROR: Please Click on the BLUE State Name.
\n"; }
else
{
print "You clicked on ", $got_state, "
\n";
}
print "
";
print "
Back to Map of USA\n";
print "
Back to Examples Page\n";
quit:
print("");
print("