#! perl -slw use strict; use threads; sub slowProcess { my( $count ) = @_; while( --$count and sleep 1 ) { print threads->self->tid(), " : $count"; } } my @threads = map{ threads->create( \&slowProcess, 1+int rand 10 ) } 1 .. 10; $_->join for @threads;