in reply to Perl advocacy
And besides, saying that the program takes less lines of code isn't necessarily a reason for choosing Perl over Java. *Why* is it good that a Perl program takes less lines of code? (Maintenance, maybe?) Give them reasons, not just assertions.
This program doesn't do what you think it does:
The biggest mistake is the initialization of @elements. Those should be parens, not curly braces. You have created a list of hash references. Your program prints out:my @elements = {'A'..'Z', 0 .. 9 }; my $i = 0; my @regkey; while($i++ < 15) { push(@regkey,$elements[rand($#elements + 1)]); +} print @regkey, "\n";
And you really don't need that many lines to write that code (since that's one of your major points :)--HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80 +e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HAS +H(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a90)HASH(0x80e4a +90)HASH(0x80e4a90)
And I'm *sure* that people can golf that down, but that's not really the point. The point is that my code shows some strengths of Perl, rather than looking like ported Java code (synthetic variables, for one thing).my @elements = ('A'..'Z', 0..9); my $regkey = join '', map { $elements[ rand @elements ] } 1..15;
Anticipate the arguments they're going to give for languages other than Perl. "Java is an industry standard"; "Java is faster"; "Students are learning Java"; etc. Give counter-arguments for these.
"Better matches"? What does that mean? Does that mean, using the same regular expression (eg. "\w+"), I can match "better" strings in Perl than in Java? :)> However, the re engine in Perl is far more sophisticated and > capable of better matches
I think what you mean to say is: Perl has a more powerful regular expression engine. And then you need to find examples of *how* it is more powerful.
UPDATE: Oops, so you did mention CPAN. However, I think you should make it a stronger point. :)
|
---|