sub receive { while (1) { $SIG{INT} = sub { # enqueue new data and stuff }; sleep; } }