Angerstein,
Not sure what you mean by "short" here. Do you want the fewest lines
of code? Quickest execution? Least typing? there are a lot of
different kinds of "short" in programming.
I'm not quite sure what you're after with '@ary[1..150]'. This is
slice notation, and it probably doesn't do what you think it does. It
doesn't create an array with 150 elements. It takes elements 1-150 of
a prexisting array and does something with them. In a foreach loop,
saying 'foreach $element (@ary[1.150])' is equivalent to saying:
foreach (1..150) {
$element = @ary[$_];
}
You're probably looking for something like the following:
foreach (1..150) {
@ary[$_] = threads->new(&net1, $proto, $time);
@ary[$_]->detatch;
}
or even
map {@ary[$_] = threads->new(&net1, $proto, $time); @ary[$_]->detach} 1..150;
I'm not sure, though, why you're bothring with the array if you're
just going to detatch. I think a little code would help us understand
better what it is you're trying to do.
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org