#!/usr/bin/perl

use strict;
use CGI qw/:standard/;

my $outfile = '/home/sixplan/tmp/remote_addr.txt';
my $cgi = new CGI;

my $old_remote_addr = '';
if ( -f $outfile ) {
    open F, $outfile;
    $old_remote_addr = join '', <F>;
    close F;
}
if ( $old_remote_addr ) {
    ($old_remote_addr) = $old_remote_addr =~ /^(\d+\.\d+\.\d+\.\d+)/;
    print $cgi->redirect(-uri => "http://$old_remote_addr");
}
