Hello, On Tue, Nov 22, 2005 at 10:58:21AM -0800, neelay thaker wrote: > Hi, > I have a Perl function which executes a series of "install" commands from a > source CD to a destination folder on the hard drive- > my $cmd = "install -m 755 $srcdir/$file1 $installdir"; > my $op = system($cmd); > $cmd = "install -m 755 $srcdir/$file2 $installdir"; > $op = system($cmd); > $cmd = "tar -zxf $file1"; > $op = system($cmd); > ...when these statements are executed first, only $file1 gets installed to > the $installdir. The second time I execute these statements, $file2 gets > installed and the third time, untaring takes place. In short, all three > commands are not executed in sequence on the same execution; I have to > execute the program thrice to get the desired result. The size of $file1 is > big, so it must be taking sometime to copy from the CD to the HD; but
I would suggest using a couple of "print" statements for debugging, along with other good trouble shooting techniques (e.g. 'use warnings'). > doesn't system command return to the execution of main program only when it > is done executing the child process? Yes. > Also, apart from the return values, are there any other differences between > the system command and the qx command? I believe the real difference between system and backtick execution is that a system call will wait until the call has finished execution before giving control back to the parent processes. Executing a command through backticks will hand immediate control back to the parent after creating a child processes. --johnk
