How that apply to our code:

foreach $key (sort { $lang->{$a}->[0] cmp $lang->{$b}->[0] } keys(%{$lang}))
>>   {
>>     # do stuff here....
>>   }

Sean Davis wrote:
Look at using lc (lower case).  It can make your sort case-insensitive.

On Jun 3, 2005, at 7:17 PM, Mike Blezien wrote:

Hello,

ran into a strange problem when doing a sort. we have a file like this:

0::Accounts;Local Language
1::Anatomy;Local Language
2::Arabic;Local Language
..................
26::German;Local Language
27::Government&politics;Local Language
.....................
3::Architecture;Local Language
4::Art&design;Local Language
5::Biochemistry;Local Language
........................
60::abcnews;local language

#######################################

Then we sort the file on the first hash array element [0]. Now it sorts all alphabetically fine, except if the characters start in lower case, then it's the last in the list after all others sorted. this is the code we use to do the sort.

foreach $key (sort { $lang->{$a}->[0] cmp $lang->{$b}->[0] } keys(%{$lang}))
  {
    # do stuff here....
  }

Is there way to sort and disregarding case ??

TIA.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to