shroh has asked for the wisdom of the Perl Monks concerning the following question:
sub main { my $path = 'E:/scripts/OutageNodes/'; require $path.'omwNodeDetails.pm'; open_log($path.'maintenanceMode_'); my $mode=get_mode(); my ($nodelist,$errorlist) = get_node($path.'serverlist.txt'); if( $mode eq 'enable'){ enable_unplanned_outage(@nodes); } elsif($mode eq 'disable'){ disable_unplanned_outage(@nodes); } else { printLog("Error invalid Mode $mode"); } # clear serverlist printLog ("Truncating serverlist"); open( SRV,'>',$path.'serverlist.txt') or die "Can't open SRV '$path.serverlist': $!"; close SRV; close_log(); printLog("there were ".scalar @$errorlist." errors in serverlist"); } sub get_node { my ($infile) = @_; my @nodelist = (); my @errorlist = (); ##checks if the file exists and pulls the info out if (-e $infile){ open INFILE, '<', $infile or die "Could not open $infile : $!"; print_log("Scanning $infile"); while (my $node = <INFILE>){ chomp($node); my ($hostname) = split /\./, $node; my $fqdn = getNodeAttributes($hostname,'PrimaryNodeName'); if (length($fqdn) < 1) { print_log("No value returned from WMI, node ($node) doesn't ex +ists in OMW."); push @errorlist,$node; } else { print_log("$node => $hostname => $fqdn"); push @nodelist,$fqdn; } } close INFILE; } else { print_log("ERROR Cannot open $infile"); } return (\@nodelist,\@errorlist); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Returning more than two arrays to the subroutine
by choroba (Cardinal) on Aug 18, 2015 at 16:35 UTC | |
Re: Returning more than two arrays to the subroutine
by GotToBTru (Prior) on Aug 18, 2015 at 16:37 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |