@array = ([1,2,3],[5,5,6],[1,4,6]); #### my $loop_index = 0; for $comma_array (@current_case_commas) { for my $comma (@$comma_array) { if($comma != "") { for (my $i=0; $i < $loop_index; $i++) { my @other_cases_array = @{$current_case_commas[$i]}; for my $other_cases (@other_cases_array) { if($other_cases = "") { if ($comma == $other_cases) { $final_case_values_duplicate{$comma} = (); } } } } for (my $i=$loop_index+1; $i <= $#current_case_commas; $i++) { my @other_cases_array = @{$current_case_commas[$i]}; for my $other_cases (@other_cases_array) { if($other_cases != "") { if ($comma == $other_cases) { $final_case_values_duplicate{$comma} = (); } } } } } } $loop_index+=1; } #### push @array, split(/[\s|\t]+/,$list_of_num);