Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: persistent new line

by trizen (Hermit)
on Feb 15, 2012 at 17:24 UTC ( #954006=note: print w/replies, xml ) Need Help??

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('')->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; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954006]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2017-06-23 14:31 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (549 votes). Check out past polls.