in reply to Re: Running PERL SCRIPTS in Parallel
in thread Running PERL SCRIPTS in Parallel

I tried to run the code but was not able to understand my @pids = map $ssh->spawn(@$_) for @cmds; It is giving error Not enough arguments for map at stress.pl line 44, near ") for " Execution of stress.pl aborted due to compilation errors. I am not able to troubleshoot. Could anyone help

my @pids = map $ssh->spawn(@$_) for @cmds; Error Not enough arguments for map at stress.pl line 44, near ") for " Execution of stress.pl aborted due to compilation errors.

Replies are listed 'Best First'.
Re^3: Running PERL SCRIPTS in Parallel
by salva (Canon) on May 22, 2013 at 08:23 UTC
    I have corrected the code.
    my @pids = map $ssh->spawn(@$_), @cmds;
    is equivalent to ...
    my @pids; for my $cmd (@cmds) { push @pids, $ssh->spawn(@$cmd); }
    It uses the Net::OpenSSH object passed to the sub to start all the commands in parallel.
Re^3: Running PERL SCRIPTS in Parallel
by rahulruns (Scribe) on May 22, 2013 at 08:22 UTC

    Thank You for the Fix. I too was able to troubleshoot

    my @pids = map $ssh->spawn(@$_) @cmds;