my $pid = open my $lsfh, "-|", "sleep", 10 or die "Cannot exec sleep: $!\n"; print "'sleep' is running in the background.\n"; print "The background process has a PID of $pid.\n"; waitpid $pid, 0; print "All done.\n";