use IPC::Open2; sub backtick { my $pid = open2(my $rfh, undef, @_); my $buf; while (<$rfh>) { $buf .= $_; } close($rfh); waitpid $pid, 0; $buf; }