in reply to referal url

Yes, the following code works. However, realize that many clients can block the referring URLs. Relying on that for security is a poor idea. (You may not be doing this, but other people might read this answer who don't already know it.) my $referer = $ENV{HTTP_REFERER};