in reply to Remove duplicates from Hash of Arrays

Perhaps the following will be helpful:

use strict; use warnings; my %h; my $HoA = { 'music' => [ 9, 53, 3, 15 ], 'conferences' => [ 7, 56, 15, 53 ], }; @h{@$_} = undef for values %$HoA; my @ids = keys %h; print "@ids"; # 53 56 3 7 9 15

What is this @h{@$_} = undef notation? See Hash from two arrays.

Replies are listed 'Best First'.
Re^2: Remove duplicates from Hash of Arrays
by Anonymous Monk on Dec 09, 2013 at 22:00 UTC
    Thanks, I will use this. After some reading up it seems setting each key to undefined can save memory when dealing with large arrays, as I sometimes will be.