my $li_insert = "insert into LI values(LI_SEQ.nextval,?,?,?,?,?,?,?,?,?,sysdate,?,?,?,?)"; my $mechanism_insert = "insert into mechanism (TAGET,ACTIONTYPE,ID,LI_ID) values(?,?,MECH_SEQ.nextval,LI_SEQ.currval)"; #### 5,2,1,12 6,1,2,12. #### { 'taget '=> [5,6], 'Action_type' =>[2,1] } #### # to get each hash from an array of hash foreach my $results(@$hash_of_excel){ my $specificresults = GroupResults($results); } sub GroupResults{ #to getonly the relevant columns(excel) for each table in the database. #%details is a global hash tha holds different tables and their corresponding column my( $AllRecords )= @_; my %specificResults; for my $info (keys %details){ $specificResults{$info}{$_} = $AllRecords->{$_} for @{$details{$info}; } } return \%specificResults; } sub SomethingUnPipeModifyRecord { #convert the joined values to array of values my( $rec ) = @_; for my $val( values %$rec ){ my $newval = [ split /\|/, $val ]; $val = $newval; } return $rec; } sub insertLI{ my ($li_results )= @_; my $li_array_values = SomethingUnPipeModifyRecord($li_results); } sub insertMech{ my ($mech_results ) = @_; my $mech_array_values = SomethingUnPipeModifyRecord($mech_results);