Help for this page

Select Code to Download


  1. or download this
    if( my $pid = fork ) {
        print "I am the parent pid ($$), and I'm going to wait for $pid to
    + exit.\n";
    ...
    } else {
        exec(qw(ls -al /tmp)); die "hrm, exec() failed: $!";
    }
    
  2. or download this
        # exec(qw(ls -al /tmp)); die ... blah
        open my $out, ">", "filename" or die $!;
    ...
        print $out $_ while <$in>;
        close $out;
        close $in;