use warnings;
use strict;
use POSIX;
my $skip_end = 0;
END { print "this should print once\n" }
if (fork)
{
print "parent\n";
sleep 1;
}
else
{
print "child\n";
$skip_end ? _exit(0) : exit(0);
}
print "last line of program\n";
####
child
this should print once
parent
last line of program
this should print once
####
parent
child
####
child
parent
last line of program
this should print once