Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by Eily (Hermit)
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 (Parson) 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 imbibing at the Monastery: (5)
As of 2014-09-02 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (19 votes), past polls