in reply to Re: How can one find unique elements from arrays using a LOOP?
in thread How can one find unique elements from arrays using a LOOP?
Hi choroba,
Thank you for your suggestions and prompt reply. My problem appears to be solved. Your last sentence (question) has been very constructive and ignited my thinking. It has helped me to sort out the problem. I have corrected the script m.pl and it goes as follows. I am grateful to you.
With regards,
Here goes the code m.pl:
#!/usr/bin/perl use warnings; use List::Compare; # Use of module @x= qw/a b/; @y= qw/a c/; @z= qw/a d/; push @s,\@x,\@y,\@z; $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;
The results of m.pl are (correct):
C:\Users\x\Desktop>m.pl Array s: ARRAY(0x320b14) ARRAY(0x320b64) ARRAY(0x3305d4) No. of Elements: 3 unq_x: b unq_y: c unq_z: d
|
|---|