Sounds fair to me, so I tried it - am I correct in using "L" instead of "N" in the unpack?
my @range = map { unpack "L", pack "C4", split /\./ } qw(10.0.0.0 10.1
+.0.0);
print "@range\n"; # the numbers themselves
print $range[1]-$range[0]+1, "\n"; # how many addresses
for ($range[0]..$range[1]) {
print join(".", unpack "C4", pack "N", $_), "\n";
}
When i do the above it reverses the input to 0.0.0.10 -> 0.0.1.10 I can fix this up I guess, but why is it doing that?
Am I using the wrong unpack data type? |