foreach $machine (@old) { chomp ($machine); stopsmc(); #Function to Stop the AV client timedelay(); #Function to delay time startsmc(); #Function to Start the AV client } sub stopsmc{ my $stop='psexec' . " " . '\\\\' . $machine . " " .$smc. " " .' -p ' . " " . "[password]". " " . "-stop"; if(system("$stop")) { print "SMC Stopped,"; } else { print "SMC Not Stopped,"; } }