# replacing system("date") with: defined(my $pid = fork) or die "Cannot fork: $!"; unless($pid) { # I'm the child # make your env changes here # you can also change directory, umask, priority, etc. exec "date"; die "date not found (just like me last friday night)"; } # parent continues here... { # to emulate system(), we need to ignore INT and QUIT # while the kid is foreground local $SIG{INT} = local $SIG{QUIT} = 'IGNORE'; waitpid($pid, 0); }