use strict; use warnings; use CGI qw(header); my $file = '/full/file/path/to/ip.log'; open LOG, '>>', $file or die "can't open ip log: $!\n"; print LOG "$ENV{REMOTE_ADDR}\n"; print header('image/png');