I am trying to fetch my dns server ip address from command prompt but I am unable to fetch it.
my @ip1 = `ipconfig/all`;
open(my $fh, '>file.txt') or die "Couldn't open file file.txt, $!";
print $fh @ip1;
close($fh);
my $row;
foreach (@ip1)
{
if($_ =~ m/DNS Servers/)
{
# print "$_";
$row = split(/:/,$_,1);
print "$row\n";
}
}
output:
1
1