use strict; use warnings; use Data::Dumper; my $file_ss = "/tmp/ONE_ACE.csv"; my $file_sc = "/tmp/TWO_ACE.csv"; my $data_ss = get_csv_data($file_ss); my $data_sc = get_csv_data($file_sc); print Dumper($data_ss); #data of the first csv file my $out_file="/tmp/aggregate.csv"; my $output_header="FileName,Status,Event ID,RR Security Code"; my $output_body = "DATA returned from the the matching eventids/rr_security_code";TODO sub get_csv_data { my $open_file = shift; my ($curr_country_currency, $new_country_currency, ); #Actual data is after line "AAB>>>>" my %data=(); #local $/=">>>\n"; if (!-f"$open_file") { report("Abort","Could not find $open_file file"); exit 1; } open(DATA,"$open_file"); while() { #Actual data after the line SSL>>>>>SSV>>>>> if(/AAB>>>>/ .. /#EOD/){ chomp; s///g; s/^\s+//g; next if /^$/; next if /AAA>>/; next if /AAB>>/; my($status, $event_id, $effdate, $last_updated, $entry_date, $curr_country, $new_country, $curr_sec_name, $new_sec_name, $msci_sec_code) = split(/\|/); $data{$open_file} = "$open_file|$status|$event_id|$msci_sec_code"; } } #while close DATA; return (%data); }