my @threads; my @ips = qw( 192.168.1.50 192.168.1.1 ); for my $ip (@ips) { push @threads, threads->new(\&polldevice,$ip, "public"); }; # Now, wait for all threads to finish: for my $thread (@threads) { print "Waiting for thread $thread to finish.\n"; my @results = $thread->join(); print "(got @results)\n"; }; print "All threads finished.\n";