in reply to Executing a command after the preceding command finished processing
Seems like you posted a very similar question on StackOverflow as How to use Perl to check when a Unix command has finished processing?