Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: How can one find unique elements from arrays using a LOOP?

by supriyoch_2008 (Monk)
on Mar 04, 2014 at 12:30 UTC ( [id://1076868]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1076868]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-25 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found