http://www.perlmonks.org?node_id=211349


in reply to Perl Functionality in Java

To get to the point: Is there a software project out there to give Java Perl power? I'm not talking about taking my perl code and stuffing it into Java, I'm talking about some org.perl.* packages that will reduce my coding time with lovely Java versions of perl beauties like map, (un)pack, printf, and grep. For example:

<p>import org.perl.*;</p> <p>Collection foo = Perl5.unpack(template, string);</p>

map, grep: Good idea for rapid prototyping. I see that one proposal is already in...just fine-tune it. There are several Java classes derived from an abstract list type.

printf: This C-ism is ill-advised, even in Perl. I think of it as "C portability support". In the absence of a perfect analog, I would become familiar with the higher-level text I/O instead.

pack/unpack: Java is designed to protect you from binary. Any pure Java implementation is likely to have the speed of molasses in July.

There are analogs of the LWP module family in Java; I would be concentrating on that for high-level internet connectivity. For instance, an image can be specified with a URL source. It's interesting watching 14 images load asynchronously....

I would also be careful with braces. If the coding style guidelines permit, you can use them to force temporary variables to go out of scope before the function exits. This is a RAM efficiency measure. The object here is not Perl-like code, but Perl-like memory recycling.