my @threads = threads->new( \&worker, \$_ ) for @flags; #### my @threads; for my $i (0..$#flags) { push(@threads, threads->new(\&worker, \$flags[$i]); }