in reply to persistent new line

Lines are ending with '\r\n', so the following code might help:
open FILE, '<:crlf', 'index.html'

Anyway, I would suggest the following script:
#!/usr/bin/perl use strict; use warnings; require LWP::UserAgent; my $ua = LWP::UserAgent->new( keep_alive => 1, env_proxy => 1, show_progress => 1, ); my $log_file = 'ipchanges.log'; open my $data_fh, '>>', $log_file or die "Unable to append to $log_fil +e: $!"; my $old_fh = select($data_fh); ++$|; select $old_fh; my $old_ip = ''; # your current ip while (1) { my $ip = ''; if ($ua->get('http://whatsmyip.net')->content =~ m{^<title>What's +My IP - Your IP is: ([\d.]+)}mi) { $ip = $1; printf {$data_fh} "***%s***@***%s***%s***\n", scalar localtime +(time), $ip, $ip eq $old_ip ? 'SAME' : 'CHANGED'; } $old_ip = $ip; sleep 60; }