Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: XS hash question

by robsv (Curate)
on May 25, 2001 at 03:27 UTC ( #83169=note: print w/replies, xml ) Need Help??


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:
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
If you're determined to use hashes, check out perlguts, and the book "Advanced Perl Programming" by Sriram Srinivasan.

- robsv

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://83169]
help
Chatterbox?
[Corion]: Hi marto!
[Corion]: I hope you were able to catch up on some sleep
Corion is slowly, slowly relaxing. Yesterday I spent vegging out in front of the PC, today at a friends, and hopefully I have the books for our Perl club done by Monday. I guess I'll only really relax once I get back from LPW

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-11-19 11:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (279 votes). Check out past polls.

    Notices?