# in the same file and package as before sub calculate_aggr_infos_with_readers { my $hash_data_reader_of_file = shift; my @data_files = keys %{$hash_data_reader_of_file}; DATA: while ( $hash_data_now = get_next_data_for_all_readers($hash_data_reader_of_file) ) { # check that the time value is the same for each set of data check_if_time_is_the_same_for_all_data($hash_data_reader_of_file); # calculate aggregated information my $hash_aggr_infos = calculate_aggr_infos_from_data($hash_data_now); # it’s a bit more complex, as i need a bit of “past data history” # to calculate the aggregated information } # end while (DATA) } # - - - end sub calculate_aggr_infos_with_readers()