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

Re: [MacPerl] sorting arrays



At 16:25 -0700 06/17/1999, Vicki Brown wrote:
>At 16:26 -0400 6/17/99, Richard Gordon wrote:
> > do, what's wrong with:
> >
> > @fields = <INFILE>;
> > s/\|\|/, /g;
> > print sort @fields;
>
>This is both elegant and simple.

For those who don't subscribe to the "Fun With Perl" mailing list, 
herewith Randal Schwartz' entry into our little discussion:

   @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.

-- --
        |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
  ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
       |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
      '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.org

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