Just another Perl shrine | |
PerlMonks |
Re^2: Syntax explanation required (uniq)by LanX (Saint) |
on Jan 03, 2013 at 01:58 UTC ( [id://1011382]=note: print w/replies, xml ) | Need Help?? |
I was meditating about advising List::MoreUtils:uniq as a best practice, cause I thought it prevents any stringification problems.¹ Unfortunately it doesn't! :(
thats quite disappointing for an XS-module ... EDIT: Well at least it preserves order... Cheers Rolf ¹) I should explain, the problem with using hashes for set operations is that keys are stringified, that means working with anything which isn't a string or at least a scalar comes with a risk. Practically it's not possible to safely use a ref as a key because of the resulting string is irreversible.
UPDATE: improved code example...
In Section
Seekers of Perl Wisdom
|
|