www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > Perl/Python/Ruby

    Perl/Python/Ruby Discussion and technical support for using and deploying Perl/Python/Ruby.

    Reply
     
    Thread Tools Rate Thread Display Modes
      #1  
    Old 03-06-2010, 05:32 AM
    kimskams80 kimskams80 is offline
    Registered User
     
    Join Date: Mar 2008
    Posts: 48
    Getting Unique Elements through Hash

    Hi Gurus,

    I have an array where each element is like this

    Text Value

    and I can easily use HASH to get unique set of elements. But hash what hash does is that it TREATS Letter's case into account too. Like if I have an element

    Factory 1

    and other

    factory 1

    then they will be stored in diff locations in Hash but I want that they should be stored on one place.

    This is the code that i use

    Code:
     my %hash   = map { $_, 1 } @BA;

    Thanks

    I dont wana use function "lc" of some other bz i want to keep the elements as they are .. but just dont want a case sensitive entry in hash

    Last edited by kimskams80; 03-06-2010 at 05:49 AM.
    Reply With Quote
      #2  
    Old 03-08-2010, 05:07 AM
    Sixtease's Avatar
    Sixtease Sixtease is offline
    Registered User
     
    Join Date: Oct 2007
    Location: Vienna, Austria
    Posts: 297
    Code:
    my %hash = map { lc($_), $_ } @BA;
    Then simply get the unique list as values %hash instead of keys %hash
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:50 AM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.