open my $shell, "|/bin/sh" || die "$!\n"; print $shell "export var=value\n"; ... print $shell "some complicated shell command # ;(){:|:&};:\n"; print $shell "/run/the/program --with-args\n";