#! /usr/bin/perl use forks; use strict; use warnings; my $thread1 = threads->new( func( 0 ) ); my $thread2 = threads->new( func( 30 ) ); $thread1->join; $thread2->join; sub func { foreach ( 1..100000 ) { print " " x $_[0], $_, "\n" } return 1; }