Im trying to learn hashes and hitting a snag. Here is what i want to do is have server1 and server2 which are both part of cluster1 and server3 and server4 which are part of cluster2. I want to take cpu(using extract command to get my cpu info) gather it from server1 and server2 and then get total by adding them together as a cluster( in the example cluser1). My problem is I want to print like this: cluster 1 cpu avr is 15.00% cluster2 cpu avr is 10.00% How do I gather the info separtely (i have to remsh to each server to get cpu info) and then push them back to know what cluster they belong too. Here is what ive tried.
From here i would do the rest of the script. except this fails. sorry for any typo i trying to remember this from memory. any help would be appreciated.%servers = ( 'server1' => 'cluser1', 'server2' => 'cluser1', 'server3' => 'cluser2', 'server4' => 'cluser2' ); foreach $key ( keys(%servers)){ push(@(values(%servers)); }
In reply to clusters with hashes by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |