@array = (%hash0, %hash1, %hash2, %hash3); for($i = 0; $i < 4; $++) { foreach $key(key "%hash[$i]" or "$array[$i]") { print "$key\n"; } }