Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Removing duplicate values for a hash of arrays

by Eily (Curate)
on Nov 21, 2013 at 18:30 UTC ( #1063773=note: print w/ replies, xml ) Need Help??


in reply to Re: Removing duplicate values for a hash of arrays
in thread Removing duplicate values for a hash of arrays

my %hash = ( a => [ '1','2', ], b => [ '2','3', ], c => [ '1','2', ], ); say "$_ => $hash{$_}" for keys %hash;
c => ARRAY(0x1abd8f0) a => ARRAY(0x1a9f998) b => ARRAY(0x1abd7a0)
So the two arrays are two different arrays, and you can't compare them with a simple cmp.


Comment on Re^2: Removing duplicate values for a hash of arrays
Select or Download Code
Re^3: Removing duplicate values for a hash of arrays
by Laurent_R (Prior) on Nov 21, 2013 at 18:55 UTC
    Yes, if the hash is built this way, these will be different array refs, but we don't know how the hash was originally constructed. This is why I asked the question.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-04 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls