#!/usr/bin/perl use warnings; use strict; use MCE::Loop chunk_size => 1, max_workers => 5; my @fruits = qw( apple banana cherry lemon lime orange peach pear plum raspberry strawberry ); mce_loop { my $fruit = $_; print "Sleeping with $fruit\n"; sleep 3 + rand 8; print "$fruit done.\n"; } \@fruits; MCE::Loop->finish;