21 lines
353 B
Perl
21 lines
353 B
Perl
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
$| = 1;
|
|
my $pid = 0;
|
|
if ( $pid = fork() ) {
|
|
print( "Parent executing.\n" );
|
|
sleep( 2 );
|
|
print( "Parent finished.\n" );
|
|
}
|
|
elsif ( defined( $pid ) ) {
|
|
print( "Child executing.\n" );
|
|
sleep( 2 );
|
|
print( "Child finished.\n" );
|
|
exit();
|
|
}
|
|
else {
|
|
die( "Could not fork" );
|
|
} |