Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Several comments.
  • You have some examples of Perl code and you say, "it takes less lines to do this in Perl than to do this in Java". But you only give an example of the Perl code! So how am I supposed to believe you that it really takes less lines? (For the record, I *do* happen to believe you, but that's neither here nor there; you're preaching to the converted, here. :)

    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.

  • Make sure that your programs work.

    This program doesn't do what you think it does:

    my @elements = {'A'..'Z', 0 .. 9 }; my $i = 0; my @regkey; while($i++ < 15) { push(@regkey,$elements[rand($#elements + 1)]); +} print @regkey, "\n";
    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:
    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 you really don't need that many lines to write that code (since that's one of your major points :)--
    my @elements = ('A'..'Z', 0..9); my $regkey = join '', map { $elements[ rand @elements ] } 1..15;
    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).

  • Make it clearer *why* they should choose Perl. "Less lines of code" isn't necessarily a reason in itself, and if all of the local universities teach Java instead of Perl, they have a *very*, *very* good reason for choosing Java. You need to give them a counter-argument.

    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.

  • You say:
    > However, the re engine in Perl is far more sophisticated and > capable of better matches
    "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? :)

    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.

  • One thing about Perl that is very, very good--that Java does not have--is CPAN. I really think you should mention CPAN. :)

    UPDATE: Oops, so you did mention CPAN. However, I think you should make it a stronger point. :)


In reply to Re: Perl advocacy by btrott
in thread Perl advocacy by tinman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2024-03-28 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found