in reply to Re: net::netmask issue in Strawberry PERL
in thread net::netmask issue in Strawberry PERL

Being a system admin, I am trying to learn this language to see where I can use it.

Now, i thought lets try to find out the IP address of a computer using this script and try to change it later on. I was able to figure out the script to find the IP address.

Is there a way I can ping that IP and if packets received is more than or eq 1, I can increase the IP by 1, do the same process and once i get the correct IP , change it using a script ?? I am using the following code now ::--

use strict; use warnings; use diagnostics; use Net::Netmask; my $result = `ipconfig | find "IPv4 Address"`; ($result) = $result =~ m/(\d+\.\d+\.\d+\.\d+)/; print "OLD IP: $result\n";
and getting following expected result ::-- OLD IP: 10.0.0.11

Replies are listed 'Best First'.
Re^3: net::netmask issue in Strawberry PERL
by CountZero (Bishop) on Sep 11, 2011 at 19:06 UTC
    Your script does not work on my version of Windows XP, so I cannot help you here.

    Perl is a great language for automating sys-admin tasks.

    Have a look at the Automating System Administration with Perl book (aka "The Otter Book") website.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James