#!/usr/bin/perl system("perl script1.pl input.txt output.txt"); # A long process system("perl script2.pl output.txt finalout.txt"); #### script2.pl : failed to open input file output.txt : No such file or directory #### #!/usr/bin/perl system("perl script1.pl input.txt output.txt"); WL: while(0) { sleep 10; if ( -e "output.txt") { system("perl script2.pl output.txt finalout.txt"); last WL; } }