in reply to Constructing hashes

As long as there is only one component value ($RM) per server, this should be fine. If you use a hash %results, then you would say:

$results{$_} = $RM; # or $1 to skip $RM alltogether print LOGFILE "$_: $RM\n"; # no need to retrieve from hash

Your loop foreach $line (@cmd) implies there could be more than one. In which case a hash of arrays could be what you want:

push @{ $results{$_} }, $RM;

and the general remark that use strict; use warnings; is recommended for scripts.

UPDATE: Re-read your question and have seen that there are several components indeed. So the second part of my answer applies. If you want to access your results, you would do this by $results{$server}->[$i] for the $i-th component.