foreach $key1 (sort keys %somehash) { # here is where I don't know how to loop through all the 'value1,value2,value3'.Consider those would not necessarily be name the same way. }