> Uri Guttman <uri@sysarch.com> wrote: > > > >>>>> "CRT" == Casey R Tweten <crt@kiski.net> writes: > > > > > > CRT> 84 characters: > > > > CRT> print sort{lc$a cmp lc$b} > > CRT> map{/(.*)\|(.*)\|(.*)/;($2?join', ',$2,$3||():$3||$1).$/}<> > > > > print sort{lc$a cmp lc$b} > > map{/(.*)\|(.*)\|(.*)/;($2?"$2${$3&&\qq{, $3}}":$1).$/}<> > > > > cut off 2 more. > Here was introduced the `pete->Peter' bug, 'cause Uri cut $3||$1 in only $1 (probably didn't noticed that). > Why all this messing about with join() or, worse, a reference- > based interpolation, when the straightforward concatenation > operator gives a solution 5 strokes shorter than Uri's? > > print sort{lc$a cmp lc$b} > map{/(.*)\|(.*)\|(.*)/;($2?$2.($3&&", $3"):$1).$/}<> > > Am I missing something? > The same bug... The correct would be print sort{lc$a cmp lc$b} map{/(.*)\|(.*)\|(.*)/;($2?$2.($3&&", $3"):$3||$1).$/}<> which is 81 chars long. The one of Jasvir Nagra is 80 chars, so one shorter, tied with the last one of last Uri's posting: print sort{lc$a cmp lc$b} map{chop;/\|(.*)\|/;($1&$'&&"$1, $'"||$1||$'||$`).$/}<> By using $2 to cut chop in the above, I got print sort{lc$a cmp lc$b} map{/\|(.*)\|(.*)/;($1?$2?"$1, $2":$1:$2||$`).$/}<> 76 characters (and works)! Can it be beaten? (And after all these sort/map uses, they even say Perl is not a functional language... it's even more functional than lisp!!!) - Branden ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe