!/usr/bin/perl -w use lib 'site_perl'; use IPC::Shareable(':all'); use Parallel::ForkManager; my $forkman = new Parallel::ForkManager(1); my $key; my %hash; my %options = ( create => 'yes', mode => 0644, exclusive => 0, destroy => 'yes' ); my $index; my $HANDLE = tie %hash, 'IPC::Shareable', 'data', { %options }; for($index=1; $index <= 7; $index++) { print "Spawning process: $index\n"; $forkman->start and next; do_this($index); $forkman->finish; } $forkman->wait_all_children; print "All children are done\n"; foreach $key (sort keys %hash) { print "PID of process $key = $hash{$key}\n"; } sub do_this { my $index = $_[0]; $HANDLE->shlock(); $hash{$index} = "PID: $$"; $hash{'test'}{'test'} = 'test'; $HANDLE->shunlock(); return 0; }