title: Find all IPs from subnet in perl
body: <p>I have an IP with subnetmask and want to create a table in which every row is an IP. </p>
  
  <p>Kind of like this:</p>
  
  <pre><code>IP          | MAC  | Alive 
  192.168.1.1 | ...  | yes
  192.168.1.2 | ...  | no
  192.168.1.3 | ...  | yes
  ...
  </code></pre>
  
  <p>For a range with subnet /24, this is easy because I can generate a for loop from 0 to 254 but I'm having trouble with generating the table with a /21 subnet. Is there a way to find in perl what the minimum host, the maximum host and everything in between is?</p>
  
  <p>I have checked the <code>Net::IP</code> and the <code>NetAddr::IP</code> module but don't seem a solution for my problem. However, I'm a perl newbie so it could be that I overlooked it.</p>
  
  <p>edit:
  found how to find first and last address:</p>
  
  <pre><code>my $range = "IP/subnet" ;
  my $ip = new Net::IP ($range) || die;
  print $ip-&gt;ip (), "\n";
  print $ip-&gt;last_ip (), "\n";
  </code></pre>
  
  <p>Now I need to find the IPs in between</p>