in reply to create new task from main program

you may want to take a look at Things you need to know before programming Perl ithreads or Activestate

It sounds like it is something you should use threads for