sorting ascedning and descending

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


thx for your help. The only way to do this is to duplicate the keys list
into an array? This doesnt seem smart for long lists. But it works! thx



Seansan wrote:

>  my $x=1;
>  if ($FORM eq 'date')
>  elsif ($FORM eq 'email')
>  elsif ($FORM eq 'group')
>  elsif ($FORM eq 'url')

my %fields = (date=>1, email=>5, group=>9, url=>4, default=>1);
my $x = defined $fields} ?
$fields} : $fields;

>  foreach (sort[$x] cmp $LIST[$x];} keys(%LIST)) {

sub ascending  { $LIST[$x] cmp $LIST[$x] }
sub descending { $LIST[$x] cmp $LIST[$x] }

my @keys = $FORM ?
     sort descending keys %LIST :
     sort ascending  keys %list ;


Re: sorting ascedning and descending

Seansan wrote:

> thx for your help.

Help on what? Who's Joe? If you're posting a reply, post a reply - don't
start a new thread for it.

Have you read the posting guidelines that appear here twice a week?


Cocoa programming in Perl:
Hire me! My resume:

Site Timeline