in reply to Re: Automatic IP address Generation
in thread Automatic IP address Generation
But that does not give me the desired results. Am I doing it correct ?#!/usr/bin/perl open(HANDLE , "result3.txt") || die("Could not open file!"); while(<HANDLE>) { chomp; use Socket qw( inet_aton inet_ntoa ); sub fr_dotted { unpack 'N', inet_aton @_ ? $_[0] : $_ } sub to_dotted { inet_aton pack 'N', @_ ? $_[0] : $_ } my $next = fr_dotted('100.1.3.41'); my $max = fr_dotted('100.1.3.50'); die if $next > $max; my $new = $next++; $new1 = to_dotted($new); print $new1; } close(HANDLE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Automatic IP address Generation
by ikegami (Patriarch) on Jul 30, 2008 at 20:21 UTC | |
by ajd335 (Novice) on Jul 30, 2008 at 22:53 UTC | |
by ikegami (Patriarch) on Jul 30, 2008 at 23:45 UTC | |
by ajd335 (Novice) on Jul 31, 2008 at 15:20 UTC | |
by ajd335 (Novice) on Jul 30, 2008 at 20:56 UTC | |
by ikegami (Patriarch) on Jul 30, 2008 at 23:47 UTC |