use strict; use warnings; use threads; use MCE::Shared; mce_open my $err_fh, '>>', \*STDERR; sub task { my $id = shift; my $str = "ab " x 3000; for (1..10000) { print $err_fh $str, "\n"; } } threads->create('task', $_) for 1..40; $_->join for threads->list;