use Thread; $thread = new Thread \&sub_name; #### sub sub_name() { for(;;) { // do stuff printf("."); sleep(1000); } }