Book Home Programming PerlSearch this book

21.2. Internal Data Types

As the tree of opcodes constituting a compiled Perl program is executed, Perl values are created, manipulated, and destroyed. The data types you're familiar with in Perl all have corresponding data types in the C under Perl's hood, and you'll need to know about those types when you pass data between the two languages.

Three C typedefs correspond to Perl's three basic data types: the SV (scalar value), AV (array value), and HV (hash value). In addition, an IV is a simple signed integer type guaranteed to be large enough to hold either a pointer or an integer; and I32 and I16 are types guaranteed to be large enough to hold 32 bits and 16 bits, respectively. For storing unsigned versions of these last three typedefs, there exist UV, U32, and U16 typedefs as well. All of these typedefs can be manipulated with the C functions described in the perlguts documentation. We sketch the behaviors of some of those functions below:

When you extend Perl, you will sometimes need to know about these values when you create bindings to C functions. When you embed Perl, you'll need to know about these values when you exchange data with the Perl interpreter included in your C program.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.