in reply to Perl's rank among languages


The Perl code that has been submitted doesn't look great. Here is the Perl code for Sum a Column of Integers:
#!/usr/local/bin/perl use integer; shift; while (<>) { $tot += $_ } print "$tot\n";
Since the number of lines is a judging criterion these 4 lines could have been written as follows:
#!/usr/bin/perl -pl $tot += $_ }{ $_ =+ $tot
Also, using integer is unnecessary and is bound to slow the code down.

However, as arhuman points out, it looks like the contest is on hold for now.

--
John.

Replies are listed 'Best First'.
Re: Re: Perl's rank among languages
by runrig (Abbot) on Jan 03, 2002 at 00:26 UTC
    Also, using integer is unnecessary and is bound to slow the code down.

    Actually, using integer when you just need integer arithmetic speeds the code up slightly (about 30% in my benchmark). The real question in this "shootout" is if its worth the extra line of code and how CPU and lines of code are weighted in the score :-)