sub worker_sub { print "worker_sub\n"; croak "testerror"; } sub worker { eval ( worker_sub() ); if ($@) { print "ERROR\n"; } sleep 2; } my $mythread = threads->create( \&worker );