unique elements (case insentitive) of an array in perl

Discussion in 'Perl' started by jjl, Oct 18, 2003.

  1. jjl

    jjl Guest

    I have an array, and try to find out the unique elements (case insentitive)
    of array. Could someone help me out. Thanks a lot.
    jjl, Oct 18, 2003
    #1
    1. Advertising

  2. jjl wrote:
    > 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
    Jürgen Exner, Oct 18, 2003
    #2
    1. Advertising

  3. > 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.
    Andrew Shitov, Oct 20, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ck
    Replies:
    17
    Views:
    3,642
    David Segall
    Mar 9, 2007
  2. ToshiBoy
    Replies:
    6
    Views:
    844
    ToshiBoy
    Aug 12, 2008
  3. Sam Kong
    Replies:
    64
    Views:
    669
  4. Dan Kohn
    Replies:
    6
    Views:
    306
    Robert Klemme
    Dec 28, 2013
  5. George Kinley

    Making array elements Unique

    George Kinley, May 11, 2004, in forum: Perl Misc
    Replies:
    6
    Views:
    141
    Kevin Collins
    May 11, 2004
Loading...

Share This Page