in reply to A Perl vs. Java fight brews

- ready interface to unix system services
Java 5 has a bit more sophisticated process management, but nothing directly related to unix.
- Open3 to control input and output between existing utility programs
You have this via the Runtime and Process objects.
- CPAN
It depends on how you look at CPAN. CPAN as something that provides API to basic needs? Java does it as well. More complex systems and these super algorithms and language changing modules, like WWW:Mechanize, Algorithm::Loops and pugs, no, java doesn't have it.
- associative arrays
Map object.
- scoped untyped variables
You can do some scoping, but not untyped.
- flexible choice of procedural versus OO (ksh is only procedural)
You can do non-oo in java, regardless of what the nay-sayers say. Just define all of your methods as static. You still have to refer to them as say ClassName.myStaticProc(...).
- perl -d (debugger - no such thing for ksh)
jdb
- perl's regexp engine is better than awk/sed's without needing to shell out
jakarta oro can do about anything perl5's regexp's can do, except commenting, execution of code w/i a regexp.
- perl's hashes are more flexible and scopable than formula engine's (Formula Engine provides only a single global hash).
dunno what this is
- perl can communicate more effectively with background processes.
In what way? You can kill, get the status of and read/write from background processes. Fork 'em off and what not.

Replies are listed 'Best First'.
Re^2: A Perl vs. Java fight brews
by Moron (Curate) on Jul 25, 2006 at 10:53 UTC
    In the OP I listed the advantages of Perl vs ksh, rather than Java which is what I wanted to know rather than express - I expect ultimately to have to make nC2 comparisons where n is the number of languages, probably in the set {ksh, Perl, Ruby, Java}, the way things are looking.

    -M

    Free your mind

      Whoops ^^ In comparison to java, THE things that yell out at me is:

      - a single algorithm in perl can be far more terse than java can be because a lot of the syntax, java forces verbosity, which in the end CAN lead to more readable code.

      - perl is very flexible, and easy to work with higher algorithms while remaining loose. it's hard to desccribe. so you get these things like mechanize.

      - java is very rigid, you gain a LOT of flexibility via patterns of use

      - java has type safety. It's really hard to not see when you missassign things beyond casting. IDE's such as eclipse and intellij make it harder to create these scenarios.

      - java can be bit more OS agnostic than perl is. Example, all filename slashes are can be written as /. All gui's can be written using swing. There are bugs in the jvm implementations that cause quirks, that do get fixed over time. I think it's more fun than dealing w/ perl/tk. I can copy a tomcat installation around from a windows box to a unix box and not recompile a thing if i start up the jvm properly.

      - java requires no c like compilation to extend, as they are written in java. java has the wretched classpath, when mixed w/ a classloader, can be a small pain to deal with

      - perl has constructs that are magnitudes easier than java will be, by design. $x[@index]=@values vs a java loop.

      - the perl community seems to be more creative, where as the java community is more goal oriented. I'd argue thta the perl community is more about coding for the love of it first, and the java community more business oriented.

      - java changes more frequently than java, but is more easy to install. perl is almost everywhere, more so than java, and does not change so often. I would attribute perl's quality there to being quite flexible to begin with. I'm not sure. Not looking for an argument :)

        Thanks - there are some new points here, though it is not yet clear how to quantify their impact.

        -M

        Free your mind

      I thought of a few more while on the train. Go vote the other node I wrote up if you like this node, so I can rid myself of the "zomg he's point whoring!"

      - Perl, mostly, by the nature of how things are compiled live from source, is more opensource than java. You CAN decompile java, but that's just an extra step and the decompilation isn't always pretty. I'm sure B::Deparse would do the same of a loaded module, but then, you can just vi that file :)

      - java is less forgiving of dependencies missing. i.e. you can't compile something that's needed by your source code. In perl, it's harder to get an error due to some bad usage of a module. Autoloader can make for fun times w/ that. :)

      - the various odd perl errors you get are findable in perldiag, where as java lacks such a mechanism.

      - perl's documentation comes with perl. java, not so much :)

      - java is backed more by money, where as perl is backed more by community, it seems. then you can get into the entire enterpriseness of both. guh, i hate that argument.

      perl is just an acronym, java is an island and coffee. tell me the name isn't just cooler :) /hides