Re: hash array sorting

2005-06-03 Thread Mike Blezien
keys(%{$lang})) Sean - Original Message - From: "Mike Blezien" <[EMAIL PROTECTED]> To: "Sean Davis" <[EMAIL PROTECTED]> Cc: "Perl List" Sent: Friday, June 03, 2005 7:36 PM Subject: Re: hash array sorting How that apply to our code: foreach $key

Re: hash array sorting

2005-06-03 Thread Sean Davis
Untested: foreach $key (sort { lc($lang->{$a}->[0]) cmp lc($lang->{$b}->[0]) } keys(%{$lang})) Sean - Original Message - From: "Mike Blezien" <[EMAIL PROTECTED]> To: "Sean Davis" <[EMAIL PROTECTED]> Cc: "Perl List" Sent:

Re: hash array sorting

2005-06-03 Thread Mike Blezien
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,

Re: hash array sorting

2005-06-03 Thread Sean Davis
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

Re: Hash array

2005-05-13 Thread Ovid
--- Mike Blezien <[EMAIL PROTECTED]> wrote: > > Arrays in scalar context return the number of elements in the > array. > > Try this: > > > > my $num_elements = @{ $hash->{$key }; > > > > thank you :) You can thank me after I post a *correct* code snippet :) my $num_elements = @{ $hash->{$

Re: Hash array

2005-05-12 Thread Mike Blezien
Ovid wrote: --- Mike Blezien <[EMAIL PROTECTED]> wrote: what is the correct proceedure to check the number of elements in a hash array, when extracting elements like $hash->{$key}->[0],$hash->{$key}->[1],.etc is there way to determine the number of elements [ ] in the $hash->{$key} if is not kn

Re: Hash array

2005-05-12 Thread Ovid
--- Mike Blezien <[EMAIL PROTECTED]> wrote: > what is the correct proceedure to check the number of elements in a > hash array, > when extracting elements like > $hash->{$key}->[0],$hash->{$key}->[1],.etc is > there way to determine the number of elements [ ] in the > $hash->{$key} if is > not