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
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 char

Re: hash array sorting

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

hash array sorting

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

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-

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

Hash array

2005-05-12 Thread Mike Blezien
Hello, 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 known so each element can be