JPERL: Accessing Perl from Java by S. Balamurugan Listing One // Passing String array as argument to Perl. // Intger and Double arrays can be passed similarly. String[] INP = new String[2]; // ... fill in INP perl.PLCallScalar("MyFunc",INP); // Ditto for PLCallArray & PLCallHash Listing Two // Passing a Hashtable and Vector as arguments to Perl Object[] ARGS = new Object[2]; Vector V; Hashtable H; // ... fill in H & V ARGS[0] = H; ARGS[1] = V; perl.PLCallScalar("MyFunc",ARGS); // Ditto for PLCallArray & PLCallHash Listing Three test.pl sub MyPerlFunc { my($a,$b) = @_; print $a,":",$b,"\n"; return 0; } sub TestFuncHash { my($a,$b) = @_; my(%ret) = ("A"=>$a,"B"=>$b); return ret; } Listing Four example.java import java.util.Hashtable; import java.util.Stack; import jp; // The Jperl interface class main { public static void main(String[] args) { String[] INP = new String[2]; INP[0] = "Data1"; INP[1] = "Data2"; try { // The perl file that contains the subroutines jp perl = new jp("test.pl"); //Turn on Debug if necessary //perl.DebugOn; // Make a call and ignore the returned value! String t = perl.PLCallScalar("MyPerlFunc",INP); String[] EvRet = perl.IPLEval("$a = 'This is a test'; $b = reverse($a); return ($a,$b);"); // Display result of evaluation for(int i=0;i