On Wed, Jun 22, 2005 at 10:50:36PM +0900, Mark Thomas wrote:
> Okay, here's the Perl version:
> 
> #!/usr/bin/perl -w
> use Math::Big 'primes';
> my $max   = 50000;
> my $start = time();
> my $total = primes($max);
> my $time  = time() - $start;
> print "There are $total primes below $max.\n";
> print "Time taken was $time\n";
> 
> On my system I get 27 vs. 192 for the original Perl version (which is
> not written very perlishly). Sure, this is cheating. CPAN is like
> institutionalized cheating, and I love it. :-) In fact, one of the
> reasons I started lurking in the Ruby group is that I think Ruby (with
> Gems) is closer to developing a CPAN-like system than Python, and thus
> I have decided to learn Ruby instead of Python.

It's perhaps worth mentioning that although Ruby is about 1/3rd of the size
of Perl, it has a far more complete standard library.

A base Ruby install includes, amongst other things: SSL, base64 encoding/
decoding, MD5/SHA1 hashing, XML/YAML parsing, HTTP client and server, and
remote method calls (DRb, SOAP, XMLRPC).

I think recent version of Perl have accumulated MIME::Base64, but the others
are still extensions you have to download and install.