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

Re: [MacPerl] Sorting



A really easy way to sort something arbitrarily (sp?) is to assign
values to the front and to use a separator between the key and the
information.  Like this:

Rules:

1. Let's say that you never use the ":" symbol in your text.

Then,

	If I wanted to sort things into azbycxdw...form I'd
	do this:

	$a[0] = "1:alert";
	$a[1] = "2:zebra";
	$a[2] = "3:bacon";
	$a[3] = "4:yak";
	$a[4] = "5:chunky";
	$a[5] = "6:xyzzy";

Then when you sort - they will always come out starting with things in
that order.  :-)

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch