#!/usr/bin/perl use diagnostics; use threads; use warnings; sub loop_threads { foreach my $thr (threads->list){ my ($a, $ref_b, $ref_c) = $thr->join(); print "\@c "; print @$ref_c; print "\n"; print "\@b "; print @$ref_b; print "\n"; } } sub foo { my ($a, $b) = @_; my @c = ("c"); return ($a, $b, \@c); } my $a = "a"; my @b = ("b"); threads->create({'context' => 'list'}, \&foo, ($a, \@b)); loop_threads();