#!/usr/bin/perl use warnings; use List::Compare; # use of module @x= qw(b); @y= qw(c); @z= qw(d); $s1=\@x; push @s,$s1; $s2=\@y; push @s,$s2; $s3=\@z; push @s,$s3; print "\n Array s: @s\n"; $all= List::Compare->new(@s); # Function of module @unq_x=$all->get_unique(0); @unq_y=$all->get_unique(1); @unq_z=$all->get_unique(2); print "\n unq_x: @unq_x\n unq_y: @unq_y\n unq_z: @unq_z\n\n"; exit; #### C:\Users\x\Desktop>n.pl Array s: ARRAY(0x2140b14) ARRAY(0x2140ae4) ARRAY(0x215a024) unq_x: b unq_y: c unq_z: d #### # To find unique elements in each array: #!/usr/bin/perl use warnings; use List::Compare; # Use of module @x= qw/b/; push @p,@x; @y= qw/c/; push @p,@y; @z= qw/d/; push @p,@z; $num=-1; for (@p) {$num++; # for LOOP starts @arr = $p{$num}; $s=\@arr; # Problem is here. # If 's' becomes s1, s2, s3 while passing # through LOOP then the program may work. # How can I change s to s1, s2, s3 etc.? push @s,$ref; } # for LOOP ends $num_ele=@s; print "\n Array s: @s\n No. of Elements: $num_ele\n"; $all= List::Compare->new(@s); # module @unq_x=$all->get_unique(0); @unq_y=$all->get_unique(1); @unq_z=$all->get_unique(2); print " unq_x: @unq_x\n unq_y: @unq_y\n unq_z: @unq_z\n\n"; exit; #### C:\Users\x\Desktop>m.pl Array s: ARRAY(0x2212004) ARRAY(0x2212004) ARRAY(0x2212004) No. of Elements: 3 unq_x: unq_y: unq_z: #### Array s: ??? No. of Elements: 3 unq_x: b unq_y: c unq_z: d