in reply to Re: How can I assign the elements in an array to only the key values in a hash?
in thread How can I assign the elements in an array to only the key values in a hash?
If you're just trying to remove duplicates from the array (which I'm not sure you are), you can do this:
my @array = getMatches();
my %tmp;
@tmp{@array} = (undef) x @array;
@array = keys %tmp;
undef %tmp;
This takes advantage of Perl's hash slices and can be incredibly useful for set-like operations.
Jerry Goure
|
|---|