use IPC::Run qw(run timeout timer); my $t = timeout(20000); my $out; run(debug => 1, ["/bin/sleep", 5], '>', \$out, $t);