in reply to xs and references
It doesn't work because Perl is not C. Scalars in Perl are SVs (and Perl strings are PVs, not chars). Also Perl passes and returns values on a stack (not the C stack), not through C's calling conventions.
Read perlxstut to understand how passing and receiving parameters work. Then browse perlapi for specific functions. I believe (without reading it myself this morning) you need to check that you have a valid RV (something like SvRVOK) -- which represents a reference in Perl -- then access the referent and assign its PV (potentially upgrading it to contain a PV).
|
|---|