Perl の Coro を使ってみた

use Coro;
use Coro::Select;

sub printit {
my ($string) = @_;
for (1..5) {
print $string, “\n”;
select undef, undef, undef, 1;
}
}

for my $coro (
async { printit ‘foo’ },
async { printit ‘bar’ },
) {
$coro->join;
}