Bringing Java into Perl

Using the Inline::Java Perl module it's possible to use inline Java code in your Perl code:

#!/usr/bin/perl
use strict;
use warnings;

use Inline Java => <<'EOJ';
public class Hi {
   String greeting;

   public Hi(String greeting) {
      this.greeting = greeting;
   }

   public void setGreeting(String newGreeting) {
      greeting = newGreeting;
   }

   public String getGreeting() {
      return greeting;
   }
}
EOJ

my $greeter = Hi->new("howdy");
print $greeter->getGreeting(), "\n";

Of course it's also possible to use already compiled Java code from within Perl.

Read about Inline::Java in this article.