Another alternative would be to refer to the Environment variable hash %ENV which contains information such as the referring page, the ip address of the referrer,etc
for example, the remote host can be obtained by :
$remote_host = $ENV{'REMOTE_HOST'};
or the referring url by :
$referrer = $ENV{'HTTP_REFERER'};
hope this helps... :)