Hi, Harold Castro <[EMAIL PROTECTED]> asked:
> Can you tell me why this loop doesn't work??? > > #!/usr/local/bin/perl > use warnings; > use strict; > > our $hostpart = 1; > our $networkpart = 128; That should probably be "my" instead of "our". > $|=1; > > while ($networkpart <= 158){ You should probably set $hostpart to 1 here, or else the inner loop will run just once up to 256, and then never again. In any case, a valid octet must be in the range of 0..255. > while ($hostpart <= 256){ > print "202.90.".$networkpart.".".$hostpart, "\n"; > ++$hostpart; > } > ++$networkpart; > } How about #!/usr/bin/perl -w use strict; use warnings; for( my $networkpart = 128; $networkpart <= 158; $networkpart++ ){ for( my $hostpart = 0; $hostpart < 256; $hostpart++ ){ print "202.90.$networkpart.$hostpart\n"; } } __END__ And if you really, really wanted to do things right you might have to consider the netmask(s) for the IP range you're looking at, because these decide what adresses are actually valid. HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>