my %first_hash = processfile($file2, $list2); foreach my $k (sort keys %first_hash){ print "$k\n$first_hash{$k}\n"; } #### MonName ARRAY(0xcb420) SrcRtr ARRAY(0xcb468) ifSpeed ARRAY(0xcb444)