Programming Perl in C
SV *sv = newSVpv("foo", 0);
av_unshift(av, 1);         // unshift(@av, undef);
av_store(av, 0, sv);       // $av[0] = "foo";
It's a bit more work, but the result is identical to Perl's unshift built in.
Deletion
An entire AV can be cleared with the av_clear() function:
av_clear(av); // @av = ();
or you can use it to clear just a single element:
av_delete(av, 9, 0); // delete the tenth element (the last arg is ignored)
Hash Values (HV)
Perl's hashes are represented in the Perl API as HVs. The HV type is the most compli 
cated of the Perl data types, and it has many more functions and macros associated 
with it than can be described here. I'll give you a subset of the available functions 
that will let you do most of what you'll need to do with hashes. In particular, I've 
avoided discussing the HE type that combines keys and values in one structure. For 
these functions, see the perlapi documentation.
Creation
HVs have a single constructor, newHV():
HV *hv = newHV();
Fetching Values
The simplest way to fetch values from a hash is with hv_fetch():
SV **svp;
// fetch $hv{foo} (last arg indicates lvalue status)
svp = hv_fetch(hv, "foo", strlen("foo"), 0);
if (!svp) croak("fetch failed: hv does not contain value for key foo");
18
187
7






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

web hosting perl

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved