#!/usr/bin/perl -w use strict; use warnings; use File::Slurp; use LWP::Simple; use Time::localtime; # Location of file to write to my $addresses = '/home/blimpton/Pro/logger/addresses.txt'; # Find out what the external IP is my $ip = get('https://automation.whatismyip.com/n09230945.asp'); $ip = 'Could find ip address!' if !$ip; # Current Date my $month = localtime->mon + 1; my $day = localtime->mday; my $year = localtime->year + 1900; my $current_date = "$month-$day-$year"; # Write to the file if ($ip = write_file($addresses, {append => 1}, $ip . ',' . $current_date . "\n"));