If you're writing this in a CGI script, (ie, putting it on the net), There's an ENV hash available through CGI. It's got a lot of useful features, but here's a couple you may want to take a look at:
- $ENV{SCRIPT_NAME}
- Gives you the location, after the root directory, of the script.
- $ENV{HTTP_HOST}
- Gives you the original hosting domain.
By using both of these, you could perhaps do something like this:
my $location = $ENV{HTTP_HOST} . $ENV{SCRIPT_NAME};
Which should give you the exact path to get to your script.
Hope I helped,
Spidy