> I too have a question about this.
> below is the code:
>
> open(A,">>/home/thx-1138/cgi-bin/data/refs.htm");
> print A "$ENV{'HTTP_REFERRER'}\n";
> close (A);
>
> The file opens, prints a return/linefeed and closes...
>
> any ideas why this wont work???
> it looks correct to me from what i have read.

I'm no where near being an expert at perl (and know even less about the rules for file 
I/O), but I'm pretty sure two things could be
wrong here:
1) The "$ENV{'HTTP_REFERRER')\n"; part for sure doesn't work because it's only 
interpolated this way if $ENV = "Joe" (for example's
sake):

The file A would have this written in it:
"Joe('HTTP_REFERRER')"

I'm not that good at explaining things, but perl can't interpolate things like that.  
It thinks that the parameters you're passing
are instead text.  To fix it, do this:

print A $ENV('HTTP_REFERRER') . "\n"; #note how the first part isn't in quotes, that's 
how the interpolation went wrong last time

2) Maybe $ENV('HTTP_REFERRER') is blank?  If so, like I told the last person, use 
CGI.pm and do this:

<perl>
use CGI qw(:standard escapeHTML);
$IP = remote_host();
open (A,">>/home/thx-1138/cgi-bin/data/refs.htm");
print A $IP . "\n";
close (A);
</perl>

I hope that helped more than it confused you.  If you need any more help, feel free to 
ask.

Joe Schulman

Reply via email to