#!/usr/bin/perl -w my $ip_last_check_file = "/home/thomas/.currentip/ip"; my $ip_now = `curl -s http://checkip.dyndns.org`; $ip_now =~ s/.*?(\d+\.\d+\.\d+\.\d+).*/$1/s; open(IP, "<$ip_last_check_file") or die "Cannot open $ip_last_check_file: $!"; my $ip_last_check = ; close(IP); if ($ip_now ne $ip_last_check) { open(IP, ">$ip_last_check_file") or die "Cannot open $ip_last_check: $!"; print IP $ip_now; close(IP); } exit;