Gossamer Forum
Home : General : Perl Programming :

Similar keys in hash

Quote Reply
Similar keys in hash
I need to filter a hash. Say I have these keys:
XXX YYYY ZZ
XXX YYYY
YYYY ZZ
XXX ZZ

I need to keep the longest one - "XXX YYYY ZZ" and throw out the second and the third one (order of the words matter). What would be the best way to do this?
Thanks
Quote Reply
Re: [AlexBGD] Similar keys in hash In reply to
Hey AlexBDG,

Can you supply a sample of the actual hash (keys and values)?