RE: Sorting associative arrays in perl


Subject: RE: Sorting associative arrays in perl
From: Leif Sawyer (lsawyer@gci.com)
Date: Wed May 08 2002 - 11:49:01 AKDT


> > This can all be combined:
> >
> > print
> > map { "$data{$_}, $_\n" }
> > sort { $data{$a} <=> $data{$b} || $a <=> $b }
> > keys(%data);
> >

Cool!

Althought I eventually just re-wrote the application to do the sorting
at a different time, which saved me the dual-key sort.

I'll have to pull an old copy and try to plug this in, see if
it makes it cleaner...

It's true, you do learn someting new every day.

(I've got to remember that map command -- must be a perl5, since it's not in
my old camel book.. Where's my new one?......

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Wed May 08 2002 - 11:49:08 AKDT