use AnyEvent; my $w = AnyEvent->timer( after => 0, interval => 5, cb => sub { print "hello "; } ); ##进入事件回旋 my $cv = AnyEvent->condvar; $cv->recv; # just like while (1) {...}