in reply to Perl Array output Help

Guesstimating what you are asking, you need to loop over each $host

# Command execution and export data to local file sub main { my @hosts = get_host(); print @hosts; print "\n"; for my $host (@hosts){ print "For host $host...\n"; my $logon = get_logon(); print $logon . "\n"; my $psswd = get_psswd(); print $psswd . "\n"; my @cmds = get_command(); print @cmds; my $output = qx(cmd); open OUTPUT, '>>' , 'devbfs51chassisshow.txt' or die " Couldn't open output.txt: $!\n"; print $OUTPUT "1plink -ssh -pw $psswd -l $logon $host @cmds"; } close OUTPUT; }

See also: looping through array

Replies are listed 'Best First'.
Re^2: Perl Array output Help
by PerlCramps (Novice) on Jun 02, 2015 at 11:19 UTC
    Thank you for the help, I am just trying to learn. I will look into looping through array.