use warnings; use strict; use IPC::Run qw(run timeout); my @cmd = qw(ls /tmp); run \@cmd, timeout(3);