unique elements (case insentitive) of an array in perl

J

jjl

I have an array, and try to find out the unique elements (case insentitive)
of array. Could someone help me out. Thanks a lot.
 
J

Jürgen Exner

jjl said:
I have an array, and try to find out the unique elements (case
insentitive) of array. Could someone help me out. Thanks a lot.

Please see "perldoc -q duplicate":
"How can I remove duplicate elements from a list or array?"

If you want case-insensitive then just define your own normal form, all
lower case of all upper case usually is the easiest.

jue
 
A

Andrew Shitov

I have an array, and try to find out the unique elements (case insentitive)
of array. Could someone help me out. Thanks a lot.

Put you elements into hash (using array elemet as a hash key) and before
putting it call uc() or lc(). When it is done, (keys %hash) will be
the desired array.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top