in reply to Thread-safe singleton in perl

It also segfaults on my Ubuntu box. However, changing
my @threads = threads->new( \&worker, \$_ ) for @flags;
to:
my @threads; for my $i (0..$#flags) { push(@threads, threads->new(\&worker, \$flags[$i]); }
makes the example work for me.