in reply to Display all IPs in given range

NetAddr::IP can be useful in this case: you can adapt to fill in your array of valid IPs in your subnet (you consider the broadcast one as valid?) see Managing your IP space with Perl
use NetAddr::IP; my $ip = new NetAddr::IP('10.0.0.0/30'); while ($ip < $ip->broadcast) { print "ip = $ip\n"; $ip ++; }

L*

PS the module also has ->first() and ->last() methods that are what you are looking for.

PPS fixed module link thanks to hippo

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Display all IPs in given range
by Noosrep (Novice) on Oct 17, 2016 at 10:30 UTC

    Yeah, I consider broadcast as valid. Looks interesting but I'm having some problems with installing the module (dependencies) so I haven't tested it yet.

    PS: call is anonymous but forgot to log in appearantly..

      forgot to log in appearantly.. if so welcome to the monastery Noosrep!

      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

        Thanks! I tried your code but it gives me Can't call method "broadcast" on an undefined value error. However, I will try tinkering some more with it.