#!/bin/perl
# File: fork3

# Demonstrate a parent creating a child who finishes after the parent.

# Call fork to create a child process
if (fork == 0) {   # Child branch
   print "I am the child. I will sleep a couple seconds.\n";
   sleep(2);
   print "I am the child and I'm gone.\n";
}

# Parent
print "I am the parent, and I'm exiting now.\n";
# system("ps -f");   # UNCOMMENT THIS LINE
# End of parent
