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

Re: [MacPerl] sorting arrays



On Thu, 17 Jun 1999 21:22:34 -0700, Vicki Brown wrote:

>   @ARGV = qw(names.txt);
>   print sort <>;
>
>It doesn't handle converting the || to , (why not just change the 
>data, hmm?) but for simple and elegant... I find it difficult to beat.

It also sorts incorrectly for some names. I know, I said it before.

	Jansens||Fientje
	Jansen||Erik

Same thing, if your're trying to sort full file paths:

	disk:folder:file
	disk:folder 2:file

The latter will (incorrectly) be put in front of the former.

As for Randal's entry...

   @ARGV = qw(names.txt);
   print sort map { s/\|\|/, " } <>;

You REALLY should learn about map(). (And I'm not talking to Vicki,
now.)


	Bart.

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