[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] sorting multidimensional hashes



I may be missing something, but isn't something like

@bycat = sort { $a->{category} cmp $b->{category} } @data;

along the lines of what you are trying to accomplish?

Arved

At 02:01 AM 4/19/00 PDT, Nicholas G. Thornton wrote:
>I'm in the process of turning a quote website from static html into a
database.
>So far I've gotten it into a tab/newline delimmited flat db. e.g.
>
>name	Seneca
>category    roman
>quote	Non ille diu vixit, sed diu fuit.
>translation  He did not live for a long time, but he lasted for a long time.
>
>which I can easily figure out how to parse into an array of hashes (i.e.
@db ->
>$db[unique quote number]{name, category...} = data) I'm wondering how I
could go
>about sorting this via the key (as 'name' or 'category'); or if there's a
better
>way to get the same result?
>
>le meas,
>--nick
>
># ===== Want to unsubscribe from this list?
># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org
>
>


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org