use strict; use warnings; # make a little mini class for your records use Class::Struct Record => [title => '$', rule_severity => '$', rule_weight => '$' ]; my %data_hash = (); my @data_array = (); $data_hash{first_key} = new Record; $data_hash{second_key} = new Record; # instead of pushing a text string of keys, just push field to access push(@data_array, 'title'); push(@data_array, 'rule_weight'); # some code later changes the hash $data_hash{first_key}->title('Mr. President'); $data_hash{first_key}->rule_weight(100); $data_hash{second_key}->title('Emperor'); $data_hash{second_key}->rule_weight(1000); # want to access it from your array for my $key (sort keys %data_hash) { for my $field (@data_array) { print "My data is (".$data_hash{$key}->$field.")\n"; } } #### C:\tmp>tmp.pl My data is (Mr. President) My data is (100) My data is (Emperor) My data is (1000)