- or download this
#!/usr/bin/env perl
use strict;
use warnings;
use threads;
- or download this
while (<DATA>) {
threads->create(sub { print 'Thread ', threads->tid, ': ', $_ })->
+join;
}
- or download this
__DATA__
list.txt line 1
list.txt line 2
list.txt line 3
- or download this
Thread 1: list.txt line 1
Thread 2: list.txt line 2
Thread 3: list.txt line 3