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

Re: [FWP] Sort challenge



>>>>> "KCI" == Keith Calvert Ivey <kcivey@cpcug.org> writes:

  KCI> Uri Guttman <uri@sysarch.com> wrote:
  >> >>>>> "CRT" == Casey R Tweten <crt@kiski.net> writes:
  >> 
  >> print sort{lc$a cmp lc$b}
  >> map{/(.*)\|(.*)\|(.*)/;($2?"$2${$3&&\qq{, $3}}":$1).$/}<>
  >> 
  >> cut off 2 more.

  KCI> Why all this messing about with join() or, worse, a reference- 
  KCI> based interpolation, when the straightforward concatenation 
  KCI> operator gives a solution 5 strokes shorter than Uri's?

  KCI>            print sort{lc$a cmp lc$b}
  KCI>            map{/(.*)\|(.*)\|(.*)/;($2?$2.($3&&", $3"):$1).$/}<>

  KCI> Am I missing something?

well, i said that dealing with $3 was the main issue left. i just was
under too much time pressure (going out) to get that solution. :)
and why i did the ref interpolation is that it beat join. i never seem
to use . by itself even when it wins like here. 

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe