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
In reply to Re: Perl Array output Help
by FreeBeerReekingMonk
in thread Perl Array output Help
by PerlCramps
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |