#!/usr/perl use strict; my @array1 = (0,1,2,3,4,5,6,7,8,9); my @array2 = (0,1,4,); my $num = "3"; my $array1size = @array1; my $array2size = @array2; for (my $count1=0;$count1 < $array1size;$count1++){ for (my $count2=0;$count2 < $array2size;$count2++){ if ($array1[$count1] == $array2[$count2]){ print $array1[$count1] . " is present in array1 and it (" . $array2[$count2] . ") is also present in array2!\n"; splice (@array1, $count1, 1); splice (@array2, $count2, 1); } } } #### O is present in array1 and it(0) is also present in array2! 1 is present in array1 and it(1) is also present in array2! 4 is present in array1 and it(4) is also present in array2!