Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: ip address list

by ikegami (Pope)
on Jan 19, 2012 at 19:59 UTC ( #948841=note: print w/ replies, xml ) Need Help??


in reply to ip address list

By the way, you might find the hostenum method useful.

my $net = NetAddr::IP->new('10.2.9.0/29'); my $seen_gateway; for my $ip ($net->hostenum) { next if !$gateway++; print $ip->addr, "\n"; }

Update: Oops, you wanted to skip the first address.

my $net = NetAddr::IP->new('10.2.9.0/29'); my @hosts = $net->hostenum; for my $ip (@hosts[1..$#hosts]) { print $ip->addr, "\n"; }


Comment on Re: ip address list
Select or Download Code
Re^2: ip address list
by mlebel (Hermit) on Jan 20, 2012 at 12:59 UTC
    Hi ikegami, that's definitely another valid way of doing it, thank you for your input!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948841]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2015-07-04 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls