#! /usr/bin/perl
use strict;
use warnings;
my $tmpfile="/tmp/ppp0-tmp1234.txt";
my $lookfor="Link is down";
my $firstline;
system "/usr/sbin/adsl-status >$tmpfile";
open INF,"<$tmpfile" or die "Can't open file

!";
$firstline = <INF>;
while(index($firstline, $lookfor)!=-1){
close INF;
system "/usr/sbin/adsl-stop";
system "/usr/sbin/adsl-start";
system "/usr/sbin/adsl-status >$tmpfile";
open INF, "<$tmpfile" or die "Can't open file

!";
$firstline = <INF>;
print $firstline,"\n";
}
print $firstline,"\n";
close INF;