# I assume @systems is already initialized and full of data. # the important thing is that you do this loop for each # system. my @drives; #loop over the systems foreach (@systems) { while ( THERE ARE MORE DRIVES ) { #get drive info push @drives, {system=>SYSTEMID, make=>MAKE, model=>MODEL, capacity=>CAPACITY, status=>STATUS }; }