Posted on 2009-03-28 15:51:05-07 by warp
running example code
Hi!

I successfully installed PLJava und now I'm trying to make the example code run.

String s2 = Perl.eval(" 'time: ' + time() ") ;
--> s2 is set to "1238255955". Is that what it should be?

int i = Perl.eval_int(" 2**10 ") ; // 1024
--> i is set to 1024. Looks correct to me.

int n = Perl.eval_int(" 10/3 ") ; // 3
--> n = 3. Correct

SV array = Perl.eval_sv(" [ 'a' , 'b' , 'c' ] ") ; String e0 = array.elem(0) ; // a String e1 = array.elem(1) ; // b String e2 = array.elem(2) ; // c


--> e0, e1 and e2 are all empty strings. :-(
SV hash = Perl.eval_sv(" { a => 11 , b => 22 , c => 33 } ") ; String k_a = hash.key("a") ; // 11 String k_b = hash.key("b") ; // 22 String k_c = hash.key("c") ; // 33


--> k_a, k_b, k_c are all empty strings, too.

What am I doing wrong?
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.