use strict; use warnings; use feature 'say'; use threads; use Thread::Queue; use CAM::PDF; use File::Find; my $q = Thread::Queue-> new; my @gang = map async( sub { while ( defined( my $f = $q-> dequeue )) { say threads-> tid, ' ', $f; my $pdf = CAM::PDF-> new( $f ) or die; } }), 1 .. 2; find( sub { -f and /\.pdf$/i and $q-> enqueue( $File::Find::name ) }, './1' ); $q-> end; $_-> join for @gang; __END__ 1 ./1/1/106/10627.pdf 2 ./1/1/107/10703.pdf 2 ./1/1/186/18673.pdf 1 ./1/1/209/20946.pdf 2 ./1/1/26/2656.pdf 1 ./1/1/33/3384.pdf 2 ./1/1/57/5742.pdf 1 ./1/1/58/5869.pdf 2 ./1/1/63/6395.pdf 1 ./1/1/70/7099.pdf 1 ./1/1/74/7466.pdf #### 1 ./1/1/106/10627.pdf 2 ./1/1/107/10703.pdf Thread 2 terminated abnormally: *****Undefined subroutine &Compress::Zlib::Parse Parameters called at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/lib/Compress/Zli b.pm line 366. 1 ./1/1/186/18673.pdf 1 ./1/1/209/20946.pdf 1 ./1/1/26/2656.pdf 1 ./1/1/33/3384.pdf 1 ./1/1/57/5742.pdf 1 ./1/1/58/5869.pdf 1 ./1/1/63/6395.pdf 1 ./1/1/70/7099.pdf 1 ./1/1/74/7466.pdf #### 1 ./1/1/106/10627.pdf 2 ./1/1/107/10703.pdf Thread 2 terminated abnormally: *****Global symbol "@ISA" requires explicit pack age name (did you forget to declare "my @ISA"?) at C:/strawberry-perl-5.28.0.1-3 2bit-PDL/perl/site/lib/Text/PDF/Filter.pm line 342. Global symbol "@basedict" requires explicit package name (did you forget to decl are "my @basedict"?) at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site/lib/Text /PDF/Filter.pm line 343. Global symbol "@basedict" requires explicit package name (did you forget to decl are "my @basedict"?) at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site/lib/Text /PDF/Filter.pm line 351. Global symbol "@basedict" requires explicit package name (did you forget to decl are "my @basedict"?) at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site/lib/Text /PDF/Filter.pm line 374. Compilation failed in require at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site /lib/CAM/PDF.pm line 5608. Thread 1 terminated abnormally: *****Global symbol "@ISA" requires explicit pack age name (did you forget to declare "my @ISA"?) at C:/strawberry-perl-5.28.0.1-3 2bit-PDL/perl/site/lib/Text/PDF/Filter.pm line 342. Global symbol "@basedict" requires explicit package name (did you forget to decl are "my @basedict"?) at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site/lib/Text /PDF/Filter.pm line 343. Global symbol "@basedict" requires explicit package name (did you forget to decl are "my @basedict"?) at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site/lib/Text /PDF/Filter.pm line 351. Global symbol "@basedict" requires explicit package name (did you forget to decl are "my @basedict"?) at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site/lib/Text /PDF/Filter.pm line 374. Compilation failed in require at C:/strawberry-perl-5.28.0.1-32bit-PDL/perl/site /lib/CAM/PDF.pm line 5608. #### die '*****' . $@;