$ perl test.pl 1 2 This Perl not built to support threads Compilation failed in require at test.pl line 3. BEGIN failed--compilation aborted at test.pl line 3. #### #! /usr/bin/perl use forks; use strict; use warnings; use Thread::Queue; use feature 'say'; sub insert_to_db { say $_[0]; } my $q = Thread::Queue->new(); # A new empty queue # Send work to the threads $q->enqueue($_) for @ARGV; # Worker threads my $thread_limit = 8; my @thr = map { threads->create(sub { while (defined (my $item = $q->dequeue_nb())) { insert_to_db($item); } }); } 1..$thread_limit; # terminate. $_->join() for @thr; __END__ $ perl test.pl 1 2 Argument "2.56_01" isn't numeric in numeric ge (>=) at /home/user/perl5/lib/perl5/x86_64-linux/forks.pm line 1570. 1 2