#! c:\perl\bin\perl
system "c:/nt/system /ipconfig /all > c:/templogin.txt" || die "Cannot append data to templogin.txt file \n";
system "set logonserver >> c:/templogin.txt" || die "cannot append logonserver to templogon.txt file \n";
open (tempfile, "c:/templogin.txt") || die "sorry nfg on templogin.txt \n";
while (<tmpfile>) {

chop ;
s/=/ /;
($ip, $add, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, $ipadd ) = split (/\s+/) ;
#print "$ip \n";
#print "$add \n";
#print "$f2 \n";

if ($f1 eq "Name"){
print "$f2 \n";
$grab = substr($f2, 0, 3);
print "grab \n";
if ($f1 eq "Address"){
print "$f2 \n";
($ip1, $ip2, $ip3, $ip4) = split (/\ /, $f2);
print "$ip3 subnet from PC \n";
if ($ip eq "LOGONSERVER"){
print "$add\n";
$logonserver = substr($add, 0, 15);

print "$grab \n";
$num1 = 0 ;
open (IPFILE, "$logonserver\\netlogon\\ipsort.txt") || die "ipsort file missing \n";
while (<IPFILE>) {
chop ;
$num1 = ($num1 + 1);
($ipin, $ipdata ) = split (/\s+/) ;
if ($ipin EQ $ip3) {
print "Have match for $ipin 2nd field = $ipdata \n";
print "$num1 b4 match found\n";
system "%logonserver%\\netlogon\\smsls" || die "Cannot append data to templogin.txt file \n";
close (IPFILE);


%PATH%\system \PC_machine_id.bat file content
ipconfig /all
set logonserver
set computername

ip_octect_number pre
i.e. Replication & synchronization deployment
i.e. 131 pre
i.e. 129 129test
i.e. 127 127test
i.e. 130 130test

Also see: ActiveState Tool Corp.'s Perl Command Line Interpreter