$start_address = "10.11.1.14:; $finish_address = "12.13.2.3";
I need to output generarate a a sequential list of addresses like the following:
10.11.1.14 10.11.1.15 10.11.1.16 ... 12.13.1.252 12.13.1.253 12.13.1.254 12.13.2.1 13.13.2.2 12.13.2.3
I have been experimenting using nested while loops for each octet. The following code works for properly enumerating the first and second octets, but I have not been successful in making the third or forth octets calculate in I continue nesting the loops.Any suggestions? I have looked at nested loops until my eyes are dizzy :-) Surely there has to be a better way than this?
$start_a = "164"; $start_b = "100"; $start_c = "10"; $start_d = "1";
$finish_a = "164"; $finish_b = "100"; $finish_c = "15"; $finish_d = "254";
$counter_b = "255";
#OCTET A while ($start_a ne ($finish_a+1)) { #OCTET B $counter_b = ($finish_b+1) unless ($start_a ne $finish_a); while ($start_b ne $counter_b) { #build A AND B addresses and output $target_addr = $start_a.".".$start_b; print "$target_addr\n"; $start_b++; } $start_a++; $start_b="1"; $counter_b="255"; }
Thanks,
Brian Burns Dizzy Perl Beginner
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]