Website hosting service by Active-Venture.com
  

 Back to Index

Array Manipulation Functions

AvFILL

Same as av_len(). Deprecated, use av_len() instead.

 
	int	AvFILL(AV* av)  

av_clear

Clears an array, making it empty. Does not free the memory used by the array itself.

 
	void	av_clear(AV* ar)  

av_delete

Deletes the element indexed by key from the array. Returns the deleted element. flags is currently ignored.

 
	SV*	av_delete(AV* ar, I32 key, I32 flags)  

av_exists

Returns true if the element indexed by key has been initialized.

This relies on the fact that uninitialized array elements are set to &PL_sv_undef.

 
	bool	av_exists(AV* ar, I32 key)  

av_extend

Pre-extend an array. The key is the index to which the array should be extended.

 
	void	av_extend(AV* ar, I32 key)  

av_fetch

Returns the SV at the specified index in the array. The key is the index. If lval is set then the fetch will be part of a store. Check that the return value is non-null before dereferencing it to a SV*.

See perlguts/"Understanding the Magic of Tied Hashes and Arrays" for more information on how to use this function on tied arrays.

 
	SV**	av_fetch(AV* ar, I32 key, I32 lval)  

av_fill

Ensure than an array has a given number of elements, equivalent to Perl's $#array = $fill;.

 
	void	av_fill(AV* ar, I32 fill)  

av_len

Returns the highest index in the array. Returns -1 if the array is empty.

 
	I32	av_len(AV* ar)  

av_make

Creates a new AV and populates it with a list of SVs. The SVs are copied into the array, so they may be freed after the call to av_make. The new AV will have a reference count of 1.

 
	AV*	av_make(I32 size, SV** svp)  

av_pop

Pops an SV off the end of the array. Returns &PL_sv_undef if the array is empty.

 
	SV*	av_pop(AV* ar)  

av_push

Pushes an SV onto the end of the array. The array will grow automatically to accommodate the addition.

 
	void	av_push(AV* ar, SV* val)  

av_shift

Shifts an SV off the beginning of the array.

 
	SV*	av_shift(AV* ar)  

av_store

Stores an SV in an array. The array index is specified as key. The return value will be NULL if the operation failed or if the value did not need to be actually stored within the array (as in the case of tied arrays). Otherwise it can be dereferenced to get the original SV*. Note that the caller is responsible for suitably incrementing the reference count of val before the call, and decrementing it if the function returned NULL.

See perlguts/"Understanding the Magic of Tied Hashes and Arrays" for more information on how to use this function on tied arrays.

 
	SV**	av_store(AV* ar, I32 key, SV* val)  

av_undef

Undefines the array. Frees the memory used by the array itself.

 
	void	av_undef(AV* ar)  

av_unshift

Unshift the given number of undef values onto the beginning of the array. The array will grow automatically to accommodate the addition. You must then use av_store to assign values to these new elements.

 
	void	av_unshift(AV* ar, I32 num)  

get_av

Returns the AV of the specified Perl array. If create is set and the Perl variable does not exist then it will be created. If create is not set and the variable does not exist then NULL is returned.

NOTE: the perl_ form of this function is deprecated.

 
	AV*	get_av(const char* name, I32 create)  

newAV

Creates a new AV. The reference count is set to 1.

 
	AV*	newAV()  

Nullav

Null AV pointer.

sortsv

Sort an array. Here is an example:

 
    sortsv(AvARRAY(av), av_len(av)+1, Perl_sv_cmp_locale);  

See lib/sort.pm for details about controlling the sorting algorithm.

 
	void	sortsv(SV ** array, size_t num_elts, SVCOMPARE_t cmp)  

 

  

 

Domain name registration - 
Register cheap domain name from $7.95 and enjoy free domain services 
 

Cheap domain name search service -
Domain name services at just
$8.95/year only
 

Register domain name -
Buy domain name registration and cheap domain transfer at low, affordable price.

© 2002-2004 Active-Venture.com Web Site Hosting Service

 

[ The disadvantage of working over networks is that you can't so easily go into someone else's office and rip their bloody heart out   ]

 

 
 
 

Disclaimer: This documentation is provided only for the benefits of our web hosting customers.
For authoritative source of the documentation, please refer to http://www.perldoc.com