Feb 1, 2012, 5:00 AM
Post #1 of 3
Execute a sub in the background
I really really need your help fast.
I'm doing a project and I have no idea how to do something.
Here is the deal.
I have a while cycle where i read every key pressed. When i press 'Enter' i want to execute a sub which has a while cycle in it but also there is a sleep in it.
Here is some example code :
if($key eq "\n")
if($key eq "261)
#do something else
while ((key = getch()) ne ERR)
sleep 5# i really need to sleep it here
So my issue is that when i execute sub_example the program freezes and waits for the cycle in the sub to finish. I want it to run in the background and still have the possibility to read from the keyboard and do stuff.
Thank you very much for your help i really needed.
(This post was edited by egzoti4en on Feb 1, 2012, 5:11 AM)