#! perl -slw use strict; use threads; use threads::shared; use Thread::Queue; use ClarRPC; #In house module my $Q = new Thread::Queue; my $ip = '10.15.51.208'; my $command = 'ping -n 15 10.15.51.208'; my @ports = 1300 .. 1302; for my $port ( @ports ) { async{ my $connection = ClarRPC->connect( $ip, $port ); my @results :shared = $connection->rpc( 'ClarRPCService::system_call', $command ); $connection->disconnect(); unshift @results, $port; $Q->enqueue( \@results, undef ); }->detach; } for ( 1 .. @ports ) { while( my $ref = $Q->dequeue ) { my( $port, @results ) = @$ref; print "$port : @results"; } } __END__ c:\test>junk4 1300 : 1 2 3 4 5 6 7 8 9 10 1301 : 1 2 3 4 5 6 7 8 9 10 1302 : 1 2 3 4 5 6 7 8 9 10