in reply to clusters with hashes

my %clusters = ( cluster1 => [ 'server1', 'server2' ], cluster2 => [ 'server3', 'server4' ], ); my %averages; while ( my ($cluster, $machines) = each %clusters ) { my @values; foreach my $machine ( @$machines ) { push @values, # Whatever you do here for $machine } $averages{ $cluster } = # Whatever you do here with @values }
Study that code. It's one proper implemention (of many). It uses many important concepts, such as references and general data structures. Please feel free to ask questions about how it works.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?