M
mingclee1
Hello,
I am running into a weird problem:
environment: unix solaris 9
I am running the following perl from command line:
test.pl:
#!/usr/local/bin/perl
use strict;
print "begin process";
system("ming2.pl");
print "after calling the processn";
ming2.pl:
#!/usr/local/bin/perl
use strict;
print "in the child process 1";
sleep(5);
print "in the child process 2";
The output is:
in the child process 1 | in the child process 2 | begin process | after
calling the process
I used | to make the output easier to read, they don't really exist in
the output.
It seemed to have executed the child process before anything in the
parent process has been executed.
However if I added \n to print "begin process": print "begin process\n"
in test.pl, then the output:
begin process
in the child process 1in the child process 2after calling the process
which shows that the parent process waits for the child process to
return. This should be the right behavior for system() command.
So, why the weird behavior? Any advise is highly appreciated!
Thanks
I am running into a weird problem:
environment: unix solaris 9
I am running the following perl from command line:
test.pl
test.pl:
#!/usr/local/bin/perl
use strict;
print "begin process";
system("ming2.pl");
print "after calling the processn";
ming2.pl:
#!/usr/local/bin/perl
use strict;
print "in the child process 1";
sleep(5);
print "in the child process 2";
The output is:
in the child process 1 | in the child process 2 | begin process | after
calling the process
I used | to make the output easier to read, they don't really exist in
the output.
It seemed to have executed the child process before anything in the
parent process has been executed.
However if I added \n to print "begin process": print "begin process\n"
in test.pl, then the output:
begin process
in the child process 1in the child process 2after calling the process
which shows that the parent process waits for the child process to
return. This should be the right behavior for system() command.
So, why the weird behavior? Any advise is highly appreciated!
Thanks