in reply to XS hash question
If you want to use hashrefs, and choose to ignore tye's
advice (in favor of speed?), you can get also the key values
using hv_fetch:
- robsv
If you're determined to use hashes, check out perlguts, and the book "Advanced Perl Programming" by Sriram Srinivasan.int calculate(hashref) SV * hashref; INIT: HV * myhash; SV **svp; int keylen; CODE: char * name; float theta; myhash = (HV *)SvRV(hashref); svp = hv_fetch(myhash,"NAME",4,0); if (svp) name = SvPV(*svp,keylen); svp = hv_fetch(myhash,"THETA",5,0); if (svp) theta = SvNV(*svp); printf("%s,%.1f\n",name,theta); . . . RETVAL = 1; OUTPUT: RETVAL
- robsv
In Section
Seekers of Perl Wisdom