in reply to Calling External Program

I agree with Perlbotics that your Perl program should just look for the PID of Mathlab and wait for it to finish. Or you can do something like

ps aux | grep <mathlab process>

and wait for this process to finish.