#! perl -slw
use strict;
use Time::HiRes qw[ time sleep ];
print 'test.pl started loading';
sub doit {
print 'doit called';
for( 1 .. 5 ) {
print scalar time;
sleep 1.5;
}
print 'doit() finished';
}
print 'test.pl finished loading';
####
#! perl -slw
use strict;
use threads;
sub testit {
do 'test.pl';
}
async {
print 'before testit()';
testit();
print 'after testit()';
doit();
}->join;
####
[18:40:12.57] C:\test>914924.pl
before testit()
test.pl started loading
test.pl finished loading
after testit()
doit called
1310924420.797
1310924422.29803
1310924423.79802
1310924425.29802
1310924426.79802
doit() finished