NAME
Data::Pointer::ARRAY - The SCALAR pointer type
SYNOPSIS
use Data::Pointer qw(ptr);
my $var = [ qw( a list of words ) ];
my $ptr = ptr( $var );
print $ptr->plus(1)->deref; # listofwords
print scalar $ptr->plus(1)->deref; # list
$ptr->deref = "foo"; # $var->[0] eq 'foo'
DESCRIPTION
The ARRAY pointer type behaves in a very simliar way to 'arrays' in C. The pointer points to inidividual elements of the array and can be incremented and dereferenced as one would expect.
METHODS
- assign($)
-
Assign the pointer to a different value p = val
- deref
-
Dereference the pointer or assign to the value it's pointing to *p *p = val
- incr(;$)
-
Increments the position of the pointer (default is 1) p++
- decr(;$)
-
Decrements the position of the pointer (default is 1) p--
- plus($)
-
Return a pointer by the given offset p + 1
- minus($)
-
Return a pointer by the given offset p - 1
AUTHOR
Dan Brook <broquaint@hotmail.com>