in reply to system() does not wait
Show us some code. See I know what I mean. Why don't you? for specific hints about posting code for this sort of problem (use a script generated csv if you really need a DB for example).
Make sure your code demonstrates the problem and only contains pertinent code.
DWIM is Perl's answer to Gödel
In Section
Seekers of Perl Wisdom