in reply to help with perl variables

From trying to decipher your very poorly formatted code, it seems to me that the $oknode variable is reset properly to 0 for each @CONNECTCOMMANDS, and therefore also for each $TEMPHOST, which, to the best of my comprehension, is presumably what you are looking for.

Please do yourself a favor: learn how to indent code correctly: although the compiler does not care about indentation, humans do a lot, proper indentation is not optional, it is essential to the comprehension of what you're writing.

As an additional side note, whenever you start to name your variable $var1, $var2, $var3, this must ring an alarm that there is almost certainly something wrong in what you are doing. The 16 variables defined in your NODE sub should probably be an array of hashes, i.e. something like this:

my @nodes = ( { host => "somenode1.domain.local", username => "user", password => "password", parnode => 4 }, { host => "somenode2.domain.local", username => "user", password => "password", parnode => 4 } # ... );
This would avoid duplication of code that you have, for example, in the MSWin32 sub, and which could be something like this (untested):
my @CONNECTCOMMANDS; for my $host (@nodes) { push @CONNECTCOMMANDS, "$SSHCOMMAND -ssh $host->{username}\@$host + -pw $host->{password}"; }
although you most probably don't need two arrays, since the second one (@CONNECTCOMMANDS) does not contain anything new compared to the original one, so that you could either use directly the first array of hashes in your subsequent code, or decide to put your ssh commands directly in your initial reference data array:
my @connection_commands = ( 'plink.exe -ssh user1@somenode1.domain.local -pw password1', 'plink.exe -ssh user2@somenode2.domain.local -pw password2', # ... );
(replacing obviously user1, user2, password1 and password2 by their actual values).

Update: as I've just posted this answer, I see that you've just now deeply edited your original post, making some of my comments (and other monks' previous comments) look off-topic or unwarranted. When you change one of your posts, please keep the original post and add updates to show the difference between the OP and the updates, as I just did here.