Any unblessed SCALAR reference that you pass from perl to javascrip will be wrapped as an instance of
PerlScalar, Blessed ones will be normally a PerlObject.
var ref = new PerlScalar(mystr);
Creates a perl scalar with a copy of somevalue and returns a new reference to it. If you pass this object to perl land it will be undistinguishable from a normal reference.
var value = ref.valueOf();
Returns the perl stringification for the reference. (Subject to change soon).