# # initializing variables, opening and reading files, etc # # a for loop to parse the file using regex $hash{$key}[$index] = {$key_1 => $val_1}; # end of for loop # writing out the data foreach my $k (sort keys(%main_hash)) { for my ($x = 0; $x < scalar(@{$main_hash{$k}}); $x++) { last if ($x + 1 >= scalar(@{$main_hash{$k}})); my ($first_key, $first_val) = each(%{$main_hash{$k}[$x]}; # take note of the lines below, where I intend to compare # $next_val to $first_val to see which has a larger value, # and if so, output a message saying that it's larger, and so on # my ($next_key, $next_val) = each(%{$main_hash{$k}[$x+1]}); # <== placeholder ==> # followed by some comparison here, eg if next_val > first_val # then do something (you get it) print OUTFILE "$first_key : $first_val\n"; } } # # some other things to do #