for my $i ($startPort..$stopPort) { my $scanPortThread = threads->new ( \&scanSinglePort,$i ); }