#!/usr/bin/perl use strict; use warnings; use threads; use myTest; my @threads; foreach ( 1..2 ) { print "launching job\n"; my $test = myTest->new(); push( @threads , threads->new( sub{ $test->myTestFunc } )); } foreach my $thread ( @threads ) { my @command_output = $thread->join ; print "job done\n"; } __END__ c:\test>t-junk2.pl launching job launching job doing job ... doing job ... job done job done