develooper Front page | perl.beginners | Postings from February 2002

foreach loop problems

Thread Next
From:
dan radom
Date:
February 13, 2002 14:44
Subject:
foreach loop problems
Message ID:
20020213224452.GA9258@lunar.radom.org
Hi,


I've got a problem with the following code...

my @hosts=qw( lunar solar venus mars saturn pluto );

foreach (\@hosts) {
        system("/usr/bin/ssh @hosts $ARGV[0]");
}

....

What I'm wanting to do is call foo.pl uname (for example) and have the script ssh host uname for each host defined in the @hosts array.  What's currently happening is that it does ssh lunar solar and dies trying to execute the next @hosts as the ssh commend.  Any ideas?

dan

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About