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

foreach loop problems

Thread Next
dan radom
February 13, 2002 14:44
foreach loop problems
Message ID:

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 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?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About