I am on WIN32.  I want to check my  a couple times of day IP and send it to my address 
at work.



for some reason, this isn't working as intended.



the if loop anyway i added the length and the string is coming back length zero



@ifRaw = `ipconfig`;

($Rest, $IP ) = split (/:/, $ifRaw[13] );

#replace any leading white space from IP address
$IP =~ s/^\s+//gm;

#print "IP address: $IP";

$ifile = 'ip.res';

$ofile = 'ip.res.tmp';

#open input file
open(INPUT, "$ifile") or die "Cannot open $ifile $!";

#open input file
open(OUT, ">$ofile") or die "Cannot open $ofile $!";

#arguments for sytem call later
@args= ("move", "$ofile", "$ifile");

while(<INPUT>) {

chomp($IPline = $_);

$IPline =~ s/^\s+//gm;

print "\nip from file: \n$IPline\n";

print "length is: ", length("$IPfile");

print "\n";

print "\nip from program: \n$IP\n\n";

print "length is: ", length("$IP");

print "\n";

if ($IPline ne $IP) {

print "The two IP addresses don't match\n";

print "creating new output file\n";

print OUT $IP;

close(OUT);

close(INPUT); 

system(@args);

print "moved $ofile to $ifile\n\n";


}

else {

#they match. send current line

close(OUT);

close(INPUT);

print "They match. Constructing mail.";

}

}

Thanks in advance



M

rest of mail routine here..









Reply via email to