NAME
Data::Pointer::ARRAY - The ARRAY 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($array_ref)
-
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([$num])
-
Increments the position of the pointer (default is 1)
p++
- decr([$num])
-
Decrements the position of the pointer (default is 1)
p--
- plus($num)
-
Return a pointer by the given offset
p + 1
- minus($num)
-
Return a pointer by the given offset
p - 1
AUTHOR
Dan Brook <broquaint@hotmail.com>
COPYRIGHT
Copyright (c) 2002, Dan Brook. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.