in reply to IP Iterator
IPv4 addresses are 32-bit numbers. Thinking of them as 4 individual bytes is counter-productive and leads to extremely convoluted code. nextIP should be:
sub nextIP { my ($ip) = @_; return $ip+1; }
exit shouldn't be called from nextIP. That's a user-interface detail while nextIP is clearly not an I/O function. A wrap can be detected by nextIP returning 0.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: IP Iterator
by camlet (Novice) on Apr 17, 2008 at 15:50 UTC | |
by camlet (Novice) on Apr 17, 2008 at 16:35 UTC | |
by ikegami (Patriarch) on Apr 17, 2008 at 18:10 UTC | |
by camlet (Novice) on Apr 18, 2008 at 22:32 UTC |