#!/usr/bin/perl use warnings; use strict; use threads; # join() does three things: it waits for a thread to exit, # cleans up after it, and returns any data the thread may # have produced. my $thr = threads->new(\&sub1); my $return = $thr->join; print "Thread returned @$return\n"; #hold for key input <>; ########################################################## sub sub1 { my @values = ('1',2, 'ten'); print "@values\n"; while(1){sleep 1} return \@values; }