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

Re: [MacPerl] sorting arrays

On Fri, 18 Jun 1999 11:57:52 +0100, Peter Westlake wrote:

>because comma, like pipe, sorts after "s".

It does?

	$, = "/";
	print "|" cmp "s", "," cmp "s";

Well, apparently, "cmp"	considers "," and "|" to be on opposite side of
the "s". Let's see:

	$, = ' ';
	print map { "$_:${\ord}" } sort (',','|','A','Z','a','z');
	',':44 'A':65 'Z':90 'a':97 'z':122 '|':124

Comma comes before all letters, pipe comes after 'em all. So comma does
work a LITTLE better than pipe. If you really like wacky results, try
one of the characters between 'Z' and 'a', such as a backslash.


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