#!/usr/bin/perl -w use threads; use threads::shared; my $i : shared = 0; push @t, threads->new( sub { $i++ for 1..100_000 } ) for 1..4; $_->join for @t; print "i=$i\n"; $ perl588t /tmp/p i=139728