use warnings; use threads; use Data::Dumper; sub funct_array { my $self = threads->self; my (@array_result) = @_; # Run some time consuming process return \@array_result; } sub funct_hash{ my $self = threads->self; my ($p1,$p2,$fn) = @_; my %hash_result=($p1,$p2); # Run some time consuming process return \%hash_result; } my ($par1,$par2,$par3,$filename, @result); $par1=1; $par2=2; $par3=4; $filename=3; my $array1 = new threads (\&funct_array,($par1,$par2,$par3,$filename,@result)); my $hash1 = threads->new(\&funct_hash,($par1,$par2,$par3,$filename)); print "Sleep"; sleep 1; # Then I tried to see the content of the array # with Data Dumper $temp = $array1->join; print "@$temp\n"; $temp = $hash1->join; foreach (keys %$temp){ print $_."=".$$temp{$_}; }