>>>>> "AB" == Andy Bach <[EMAIL PROTECTED]> writes:
AB> Another list (discussing ICON) got me to: AB> http://www.bagley.org/~doug/shootout/ AB> and checking on perl's results found it sort of in the middle. AB> http://www.bagley.org/~doug/shootout/lang/perl/ gack, that place has some bad perl answers. we should/can redo them and make the shorter and faster and probably use less memory. this has all the perl code. http://www.bagley.org/~doug/shootout/lang/perl/allsrc.shtml i don't see any rules on using modules and cpan. the echo client/server uses Socket.pm and not IO::Socket. it would be much shorted with the latter. i dunno how much slower. even the code written is not great with Socket.pm. the count lines/words/chars is not well done either. use strict; my($nl, $nw, $nc); while (read(STDIN, $_, 4095)) { $_ .= <STDIN>; $nl += scalar(split(/\n/)); $nc += length; $nw += scalar(split); } print "$nl $nw $nc\n"; the author obviously never heard of tr/// for counting chars. would tr/ //s be a proper count of words split on multiple spaces? i think you could convert to sysread and drop the extra <STDIN> with that. anyone want to tackle rewriting these? i am interested. uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com - Damian Conway Perl Classes -- July 1-3 -- http://stemsystems.com/class/ --- ----- Stem and Perl Development, Systems Architecture, Design and Coding ---- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
