#!/usr/bin/perl -w use strict; use warnings; main (@ARGV); sub main { # This array contains the list of hosts my @host = ("ajsfdevbcs11", "ajsfdevbcs12"); my $i; for($i = 0; $host[$i]; $i++) { # message ($host[$i]); } # This is the logon ID my $user = "tsasa067"; # message ($user); # This is the logon password my $security = 'F@therL0^eMe'; # message ($security); # These are the commands I would like to run my @cmd = ("switchname", "chassisshow", "switchstatusshow", "switchshow"); my $j; for($j = 0; $cmd[$j]; $j++) { # message ($cmd[$j]); } my @results = 'plink -ssh -pw = $security -l = $user $host'; print $results[0]; } sub message { my $m = shift or return; print ("$m\n"); } sub error { my $e = shift || 'unkown error'; print("$0: $e\n"); exit 0; }