in reply to Re: Re: equal keys in a hash
in thread equal keys in a hash
Did you test this?
No. Did you read my .sig? :)
To my surprise, you're right. It does just recreate the orginal without getting rid of duplicates. To avoid the intermediate hash, you have to force the first reverse (taken in order of execution) to return a referance to hash, which is then immediately dereferanced:
my %hash_without_duplicates = reverse %{ +{ reverse %hash_with_duplica +tes } };
I actually have tested the above :)
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|