|
|||||||
| Perl/Python/Ruby Discussion and technical support for using and deploying Perl/Python/Ruby. |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
Code:
my %hash = map { lc($_), $_ } @BA;
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|