in reply to Code for port scanner on range of IPs

Hi,

Please use warnings and strict in your scripts. It will help identify several errors to start with.
There are several variables that were not defined that just "popped" up everywhere such as "$target","$maxport","$port" used before the second foreach loop, then another "$port" used in the second foreach loop.

You really don't need the second while loop with the REs to get your variables $min_ip and $max_ip like so:

... while($line=~/(\d+.\d+.\d+.\d+)-(\d+.\d+.\d+.\d+)/g){ ...
that you could achieve within the first while loop like so:
... my($min_ip,$max_ip)=split/-/,$line; ...