User
#!/usr/bin/env perl use strict; use threads; use Time::HiRes qw( usleep ); sub out_tomorrow{ my ($delay,$str)=@_; usleep($delay*50000); print $str; threads->detach(); } for( my ($i,$c3,$c5)=(1,2,4); $i<=100; $i++, $c3--, $c5-- ){ my $s = ( ( (!$c3) || (!$c5) ) ? '' : $i ) . ( $c3 ? '' : ($c3=3,"Fizz") ) . ( $c5 ? '' : ($c5=5,"Buzz") ) . "\n" ; threads->create( {'void' => 1}, \&out_tomorrow, $i, $s ); } while( threads->list(threads::running) ){};